Class: QueryOutput
- Inherits:
-
Object
- Object
- QueryOutput
- Defined in:
- lib/query_output.rb
Instance Method Summary collapse
-
#initialize(connection, query) ⇒ QueryOutput
constructor
A new instance of QueryOutput.
- #show ⇒ Object
- #show_text_or_table ⇒ Object
Constructor Details
#initialize(connection, query) ⇒ QueryOutput
3 4 5 6 |
# File 'lib/query_output.rb', line 3 def initialize(connection, query) @connection = connection @query = query end |
Instance Method Details
#show ⇒ Object
8 9 10 11 |
# File 'lib/query_output.rb', line 8 def show exec @connection.error? ? print_error : print_tables end |
#show_text_or_table ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/query_output.rb', line 13 def show_text_or_table exec if @connection.one_column_one_row? print_text else print_tables unless @connection.error? end print_error if @connection.error? end |