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:

  • (ArgumentError)


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

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

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


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

def set_types(column_types)
  raise NotImplementedError.new
end

#to_sObject

Display the command text



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

def to_s
  @text
end