class Backfiller::Cursor::Postgresql
Attributes
connection[R]
Public Class Methods
new(connection, name, query)
click to toggle source
# File lib/backfiller/cursor/postgresql.rb, line 8 def initialize(connection, name, query) @connection = connection @name = name @query = query end
Public Instance Methods
close()
click to toggle source
# File lib/backfiller/cursor/postgresql.rb, line 41 def close @connection.execute "CLOSE #{@name}" end
fetch(count)
click to toggle source
# File lib/backfiller/cursor/postgresql.rb, line 37 def fetch(count) @connection.select_all "FETCH #{count} FROM #{@name}" end
open()
click to toggle source
# File lib/backfiller/cursor/postgresql.rb, line 33 def open @connection.execute "DECLARE #{@name} NO SCROLL CURSOR WITHOUT HOLD FOR #{@query}" end
transaction() { || ... }
click to toggle source
Open cursor, call black and close cursor in transaction.
@return [Object] yielded block result.
# File lib/backfiller/cursor/postgresql.rb, line 17 def transaction result = nil @connection.transaction do Backfiller.log 'Open cursor' open result = yield Backfiller.log 'Close cursor' close end result end