File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
lib/new_relic/telemetry/ecto Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -43,17 +43,16 @@ defmodule NewRelic.Telemetry.Ecto.Metadata do
43
43
# Exqlite: table
44
44
@ esc ~w( " ` [ ])
45
45
46
- @ capture % {
47
- select: ~r/ FROM (?<table>\S +)/ ,
48
- insert: ~r/ INSERT INTO (?<table>\S +)/ ,
49
- update: ~r/ UPDATE (?<table>\S +)/ ,
50
- delete: ~r/ FROM (?<table>\S +)/ ,
51
- create: ~r/ CREATE TABLE( IF NOT EXISTS)? (?<table>\S +)/
52
- }
53
46
def parse_query ( operation , query ) do
54
- case Regex . named_captures ( @ capture [ operation ] , query ) do
47
+ case Regex . named_captures ( capture ( operation ) , query ) do
55
48
% { "table" => table } -> { operation , String . replace ( table , @ esc , "" ) }
56
49
_ -> { operation , :other }
57
50
end
58
51
end
52
+
53
+ defp capture ( :select ) , do: ~r/ FROM (?<table>\S +)/
54
+ defp capture ( :insert ) , do: ~r/ INSERT INTO (?<table>\S +)/
55
+ defp capture ( :update ) , do: ~r/ UPDATE (?<table>\S +)/
56
+ defp capture ( :delete ) , do: ~r/ FROM (?<table>\S +)/
57
+ defp capture ( :create ) , do: ~r/ CREATE TABLE( IF NOT EXISTS)? (?<table>\S +)/
59
58
end
You can’t perform that action at this time.
0 commit comments