class RR::ProxyCursor

Provides shared functionality for ProxyRowCursor and ProxyBlockCursor

Attributes

connection[RW]

The current ProxyConnection.

cursor[RW]

The current cursor.

primary_key_names[RW]

Array of primary key names for current table.

table[RW]

The name of the current table.

Public Class Methods

new(connection, table) click to toggle source

Shared initializations

* connection: the current proxy connection
* table: table_name
# File lib/rubyrep/proxy_cursor.rb, line 24
def initialize(connection, table)
  self.connection = connection
  self.table = table
  self.primary_key_names = connection.primary_key_names table
end

Public Instance Methods

destroy() click to toggle source

Releases all ressources

# File lib/rubyrep/proxy_cursor.rb, line 39
def destroy
  self.cursor.clear if self.cursor
  self.cursor = nil
end
prepare_fetch(options = {}) click to toggle source

Initiate a query for the specified row range. options: An option hash that is used to construct the SQL query. See ProxyCursor#construct_query for details.

# File lib/rubyrep/proxy_cursor.rb, line 32
def prepare_fetch(options = {})
  self.cursor = connection.select_cursor(
    options.merge(:table => table, :type_cast => true)
  )
end