Class: RR::ProxyCursor
- Inherits:
-
Object
- Object
- RR::ProxyCursor
- Defined in:
- lib/rubyrep/proxy_cursor.rb
Overview
Provides shared functionality for ProxyRowCursor and ProxyBlockCursor
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
The current ProxyConnection.
-
#cursor ⇒ Object
The current cursor.
-
#primary_key_names ⇒ Object
Array of primary key names for current table.
-
#table ⇒ Object
The name of the current table.
Instance Method Summary collapse
-
#destroy ⇒ Object
Releases all ressources.
-
#initialize(connection, table) ⇒ ProxyCursor
constructor
Shared initializations * connection: the current proxy connection * table: table_name.
-
#prepare_fetch(options = {}) ⇒ Object
Initiate a query for the specified row range.
Constructor Details
#initialize(connection, table) ⇒ ProxyCursor
Shared initializations
* connection: the current proxy connection
* table: table_name
24 25 26 27 28 |
# 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 |
Instance Attribute Details
#connection ⇒ Object
The current ProxyConnection.
10 11 12 |
# File 'lib/rubyrep/proxy_cursor.rb', line 10 def connection @connection end |
#cursor ⇒ Object
The current cursor.
19 20 21 |
# File 'lib/rubyrep/proxy_cursor.rb', line 19 def cursor @cursor end |
#primary_key_names ⇒ Object
Array of primary key names for current table.
16 17 18 |
# File 'lib/rubyrep/proxy_cursor.rb', line 16 def primary_key_names @primary_key_names end |
#table ⇒ Object
The name of the current table.
13 14 15 |
# File 'lib/rubyrep/proxy_cursor.rb', line 13 def table @table end |
Instance Method Details
#destroy ⇒ Object
Releases all ressources
39 40 41 42 |
# File 'lib/rubyrep/proxy_cursor.rb', line 39 def destroy self.cursor.clear if self.cursor self.cursor = nil end |
#prepare_fetch(options = {}) ⇒ Object
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.
32 33 34 35 36 |
# File 'lib/rubyrep/proxy_cursor.rb', line 32 def prepare_fetch( = {}) self.cursor = connection.select_cursor( .merge(:table => table, :type_cast => true) ) end |