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
8 9 10 11 12 13 |
# File 'lib/data_objects/command.rb', line 8 def initialize(connection, text) raise ArgumentError, '+connection+ must be a DataObjects::Connection' unless connection.is_a?(DataObjects::Connection) @connection = connection @text = text end |
Instance Attribute Details
#connection ⇒ Object (readonly)
The Connection on which the command will be run
5 6 7 |
# File 'lib/data_objects/command.rb', line 5 def connection @connection end |
Instance Method Details
#execute_non_query(*_args) ⇒ Object
Execute this command and return no dataset
16 17 18 |
# File 'lib/data_objects/command.rb', line 16 def execute_non_query(*_args) raise NotImplementedError end |
#execute_reader(*_args) ⇒ Object
Execute this command and return a DataObjects::Reader for a dataset
21 22 23 |
# File 'lib/data_objects/command.rb', line 21 def execute_reader(*_args) raise NotImplementedError end |
#set_types(_column_types) ⇒ Object
Assign an array of types for the columns to be returned by this command
26 27 28 |
# File 'lib/data_objects/command.rb', line 26 def set_types(_column_types) raise NotImplementedError end |
#to_s ⇒ Object
Display the command text
31 32 33 |
# File 'lib/data_objects/command.rb', line 31 def to_s @text end |