Class: DataObjects::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/data_objects/command.rb

Overview

Abstract base class for adapter-specific Command subclasses

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, text) ⇒ Command

Create a new Command object on the specified connection

Raises:



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

#connectionObject (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

Raises:



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

Raises:



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

Raises:



26
27
28
# File 'lib/data_objects/command.rb', line 26

def set_types(_column_types)
  raise NotImplementedError
end

#to_sObject

Display the command text



31
32
33
# File 'lib/data_objects/command.rb', line 31

def to_s
  @text
end