Class: DbAgile::Command::SQL::Heading
- Inherits:
-
DbAgile::Command
- Object
- DbAgile::Command
- DbAgile::Command::SQL::Heading
- Defined in:
- lib/dbagile/command/sql/heading.rb
Overview
Show the heading of a table
Usage: dba #DbAgile::Command#command_name TABLE
This commands shows a list with columns names and types for a given table of the current SQL database.
Constant Summary
Constants inherited from DbAgile::Command
Instance Attribute Summary collapse
-
#dataset ⇒ Object
Table whose heading must be displayed.
Attributes inherited from DbAgile::Command
Attributes included from ClassMethods
#description, #summary, #usage
Instance Method Summary collapse
-
#execute_command ⇒ Object
Executes the command.
-
#normalize_pending_arguments(arguments) ⇒ Object
Normalizes the pending arguments.
Methods inherited from DbAgile::Command
#add_options, #category, #check_command, #command_name, #description, #initialize, #options, #run, #set_default_options, #show_help, #summary, #unsecure_run, #usage
Methods included from ClassMethods
#build_command_options, #build_me, #category, #command_for, #command_name, #command_name_of, #each_subclass, #inherited, #ruby_method_for, #subclasses
Methods included from Robust
#ambigous_argument_list!, #assumption_error!, #bad_argument_list!, #has_command!, #is_in!, #valid_argument_list!, #valid_read_file!
Methods included from DbAgile::Core::IO::Robustness
#has_database!, #valid_database_name!, #valid_database_uri!, #valid_schema_files!
Constructor Details
This class inherits a constructor from DbAgile::Command
Instance Attribute Details
#dataset ⇒ Object
Table whose heading must be displayed
16 17 18 |
# File 'lib/dbagile/command/sql/heading.rb', line 16 def dataset @dataset end |
Instance Method Details
#execute_command ⇒ Object
Executes the command
24 25 26 27 28 29 30 |
# File 'lib/dbagile/command/sql/heading.rb', line 24 def execute_command with_current_connection do |connection| heading = connection.heading(self.dataset) flush("{\n" + heading.collect{|pair| " #{pair[0]}: #{pair[1]}"}.join(",\n") + "\n}\n") heading end end |
#normalize_pending_arguments(arguments) ⇒ Object
Normalizes the pending arguments
19 20 21 |
# File 'lib/dbagile/command/sql/heading.rb', line 19 def normalize_pending_arguments(arguments) self.dataset = valid_argument_list!(arguments, Symbol) end |