Class: Fiveruns::Tuneup::Step::SQL::Explain
- Inherits:
-
Object
- Object
- Fiveruns::Tuneup::Step::SQL::Explain
- Defined in:
- lib/fiveruns/tuneup/step.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize(sql, connection) ⇒ Explain
constructor
A new instance of Explain.
- #table_offset ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(sql, connection) ⇒ Explain
Returns a new instance of Explain.
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/fiveruns/tuneup/step.rb', line 167 def initialize(sql, connection) result = connection.execute("explain #{sql}") @fields = fetch_fields_from(result) @rows = fetch_rows_from(result) result.free add_schemas(connection) @valid = true rescue Exception @valid = false end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
165 166 167 |
# File 'lib/fiveruns/tuneup/step.rb', line 165 def fields @fields end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
165 166 167 |
# File 'lib/fiveruns/tuneup/step.rb', line 165 def rows @rows end |
Instance Method Details
#table_offset ⇒ Object
182 183 184 |
# File 'lib/fiveruns/tuneup/step.rb', line 182 def table_offset @table_offset ||= @fields.index('table') end |
#valid? ⇒ Boolean
178 179 180 |
# File 'lib/fiveruns/tuneup/step.rb', line 178 def valid? @valid end |