Class: Gitlab::Database::QueryAnalyzer::Parsed
- Inherits:
-
Object
- Object
- Gitlab::Database::QueryAnalyzer::Parsed
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/database/query_analyzer.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#cached? ⇒ Boolean
Returns true if the query was using the ActiveRecord Query Cache.
-
#initialize(raw, connection, event_name, cached) ⇒ Parsed
constructor
A new instance of Parsed.
- #pg ⇒ Object
- #sql ⇒ Object
Constructor Details
#initialize(raw, connection, event_name, cached) ⇒ Parsed
Returns a new instance of Parsed.
18 19 20 21 22 23 24 |
# File 'lib/gitlab/database/query_analyzer.rb', line 18 def initialize(raw, connection, event_name, cached) @raw = raw @connection = connection @event_name = normalize_event_name(event_name) @cached = cached @error = nil end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
16 17 18 |
# File 'lib/gitlab/database/query_analyzer.rb', line 16 def connection @connection end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
16 17 18 |
# File 'lib/gitlab/database/query_analyzer.rb', line 16 def error @error end |
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
16 17 18 |
# File 'lib/gitlab/database/query_analyzer.rb', line 16 def event_name @event_name end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
16 17 18 |
# File 'lib/gitlab/database/query_analyzer.rb', line 16 def raw @raw end |
Instance Method Details
#cached? ⇒ Boolean
Returns true if the query was using the ActiveRecord Query Cache
27 28 29 |
# File 'lib/gitlab/database/query_analyzer.rb', line 27 def cached? !!@cached end |
#pg ⇒ Object
38 39 40 41 42 |
# File 'lib/gitlab/database/query_analyzer.rb', line 38 def pg try_parse do PgQuery.parse(raw) end end |
#sql ⇒ Object
31 32 33 34 35 |
# File 'lib/gitlab/database/query_analyzer.rb', line 31 def sql try_parse do PgQuery.normalize(raw) end end |