Class: Bricolage::PostgresConnection::Cursor

Inherits:
Object
  • Object
show all
Defined in:
lib/bricolage/postgresconnection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, conn, logger) ⇒ Cursor

Returns a new instance of Cursor.



223
224
225
226
227
# File 'lib/bricolage/postgresconnection.rb', line 223

def initialize(name, conn, logger)
  @name = name
  @conn = conn
  @logger = logger
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



229
230
231
# File 'lib/bricolage/postgresconnection.rb', line 229

def name
  @name
end

Instance Method Details

#each_result_set(fetch_size = 5000) ⇒ Object



231
232
233
234
235
236
237
238
# File 'lib/bricolage/postgresconnection.rb', line 231

def each_result_set(fetch_size = 5000)
  while true
    @conn.execute_query("fetch #{fetch_size} in #{@name}") {|rs|
      return if rs.values.empty?
      yield rs
    }
  end
end