Class: DataObjects::Command
- Inherits:
-
Object
- Object
- DataObjects::Command
- Defined in:
- lib/data_objects/command.rb
Overview
Abstract base class for adapter-specific Command subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
The Connection on which the command will be run.
Instance Method Summary collapse
-
#execute_non_query(*args) ⇒ Object
Execute this command and return no dataset.
-
#execute_reader(*args) ⇒ Object
Execute this command and return a DataObjects::Reader for a dataset.
-
#initialize(connection, text) ⇒ Command
constructor
Create a new Command object on the specified connection.
-
#set_types(column_types) ⇒ Object
Assign an array of types for the columns to be returned by this command.
-
#to_s ⇒ Object
Display the command text.
Constructor Details
#initialize(connection, text) ⇒ Command
Create a new Command object on the specified connection
9 10 11 12 |
# File 'lib/data_objects/command.rb', line 9 def initialize(connection, text) raise ArgumentError.new("+connection+ must be a DataObjects::Connection") unless DataObjects::Connection === connection @connection, @text = connection, text end |
Instance Attribute Details
#connection ⇒ Object (readonly)
The Connection on which the command will be run
6 7 8 |
# File 'lib/data_objects/command.rb', line 6 def connection @connection end |
Instance Method Details
#execute_non_query(*args) ⇒ Object
Execute this command and return no dataset
15 16 17 |
# File 'lib/data_objects/command.rb', line 15 def execute_non_query(*args) raise NotImplementedError.new end |
#execute_reader(*args) ⇒ Object
Execute this command and return a DataObjects::Reader for a dataset
20 21 22 |
# File 'lib/data_objects/command.rb', line 20 def execute_reader(*args) raise NotImplementedError.new end |
#set_types(column_types) ⇒ Object
Assign an array of types for the columns to be returned by this command
25 26 27 |
# File 'lib/data_objects/command.rb', line 25 def set_types(column_types) raise NotImplementedError.new end |
#to_s ⇒ Object
Display the command text
30 31 32 |
# File 'lib/data_objects/command.rb', line 30 def to_s @text end |