Skip to content

Instantly share code, notes, and snippets.

@burke
Created January 14, 2010 21:16
Show Gist options
  • Save burke/277519 to your computer and use it in GitHub Desktop.
Save burke/277519 to your computer and use it in GitHub Desktop.
class Mysql
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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment