Class: NPlusInsight::Query
- Inherits:
-
Struct
- Object
- Struct
- NPlusInsight::Query
- Defined in:
- lib/n_plus_insight/query.rb
Instance Attribute Summary collapse
-
#cached ⇒ Object
Returns the value of attribute cached.
-
#duration_ms ⇒ Object
Returns the value of attribute duration_ms.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#sql ⇒ Object
Returns the value of attribute sql.
-
#tables ⇒ Object
Returns the value of attribute tables.
Instance Method Summary collapse
Instance Attribute Details
#cached ⇒ Object
Returns the value of attribute cached
2 3 4 |
# File 'lib/n_plus_insight/query.rb', line 2 def cached @cached end |
#duration_ms ⇒ Object
Returns the value of attribute duration_ms
2 3 4 |
# File 'lib/n_plus_insight/query.rb', line 2 def duration_ms @duration_ms end |
#location ⇒ Object
Returns the value of attribute location
2 3 4 |
# File 'lib/n_plus_insight/query.rb', line 2 def location @location end |
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/n_plus_insight/query.rb', line 2 def name @name end |
#sql ⇒ Object
Returns the value of attribute sql
2 3 4 |
# File 'lib/n_plus_insight/query.rb', line 2 def sql @sql end |
#tables ⇒ Object
Returns the value of attribute tables
2 3 4 |
# File 'lib/n_plus_insight/query.rb', line 2 def tables @tables end |
Instance Method Details
#binds_signature ⇒ Object
12 13 14 |
# File 'lib/n_plus_insight/query.rb', line 12 def binds_signature normalized_sql end |
#normalized_sql ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/n_plus_insight/query.rb', line 3 def normalized_sql sql.to_s .gsub(/'(?:[^']|'')*'/, "?") .gsub(/\b\d+(?:\.\d+)?\b/, "?") .gsub(/\bIN\s*\((?:\s*\?,?\s*)+\)/i, "IN (?)") .gsub(/\s+/, " ") .strip end |