Sha256: 63ea5ae4924c315726a8a3ef6df6568fbbea2e9f2011ba56ad1d8dcbd6bc2528

Contents?: true

Size: 1.18 KB

Versions: 17

Compression:

Stored size: 1.18 KB

Contents

$LOAD_PATH.unshift File.dirname(__FILE__) + '/..'

require 'rubyrep'

module RR
  # Provides shared functionality for ProxyRowCursor and ProxyBlockCursor
  class ProxyCursor
    
    # The current ProxyConnection.
    attr_accessor :connection
    
    # The name of the current table.
    attr_accessor :table
    
    # Array of primary key names for current table.
    attr_accessor :primary_key_names
    
    # The current cursor.
    attr_accessor :cursor
    
    # Shared initializations 
    #   * connection: the current proxy connection
    #   * table: table_name
    def initialize(connection, table)
      self.connection = connection
      self.table = table
      self.primary_key_names = connection.primary_key_names table
    end
    
    # 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.
    def prepare_fetch(options = {})
      self.cursor = connection.select_cursor(
        options.merge(:table => table, :type_cast => true)
      )
    end
    
    # Releases all ressources
    def destroy
      self.cursor.clear if self.cursor
      self.cursor = nil
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
rubyrep-2.0.1 lib/rubyrep/proxy_cursor.rb
rubyrep-2.0.0 lib/rubyrep/proxy_cursor.rb
andyjeffries-rubyrep-1.2.1 lib/rubyrep/proxy_cursor.rb
rubyrep-1.2.0 lib/rubyrep/proxy_cursor.rb
rubyrep-1.1.2 lib/rubyrep/proxy_cursor.rb
rubyrep-1.1.1 lib/rubyrep/proxy_cursor.rb
rubyrep-1.1.0 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.9 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.8 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.3 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.4 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.5 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.6 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.7 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.0 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.1 lib/rubyrep/proxy_cursor.rb
rubyrep-1.0.2 lib/rubyrep/proxy_cursor.rb