Class: Mysql

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

Instance Method Summary collapse

Instance Method Details

#incremental_query(query, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mysql_incremental_query.rb', line 2

def incremental_query(query, &block)
  result = nil;
  def result.free;end
  begin
    qwr = self.query_with_result
    self.query_with_result = false
    result = self.query(query).use_result
    result.each { |row| yield(row) }
    self.query_with_result = qwr
  ensure
    result.free
  end
end