Class: Shiba::Console::Command
- Inherits:
-
Object
- Object
- Shiba::Console::Command
- Defined in:
- lib/shiba/console.rb
Instance Method Summary collapse
- #execute(query) ⇒ Object
-
#initialize(context) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(context) ⇒ Command
Returns a new instance of Command.
87 88 89 |
# File 'lib/shiba/console.rb', line 87 def initialize(context) @context = context end |
Instance Method Details
#execute(query) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/shiba/console.rb', line 91 def execute(query) if !valid_query?(query) msg = "Query does not appear to be a valid relation or select sql string" msg << "\n#{usage}" puts msg return end result = explain(query) if result == nil puts "Unable to analyze query, please check the SQL syntax for typos." return end record = ExplainRecord.new(result) puts record. record end |