Skip to content

Instantly share code, notes, and snippets.

@vroy
Created October 26, 2009 18:54
Show Gist options
  • Save vroy/218920 to your computer and use it in GitHub Desktop.
Save vroy/218920 to your computer and use it in GitHub Desktop.
class Mysql
def proc(str)
DB.query_with_result = false
resultsets = []
no_more_results=false
DB.query( %(call #{str}) )
until no_more_results
begin
rs = DB.use_result
rescue Mysql::Error => e
no_more_results = true
end
if no_more_results == false
resultset = []
rs.each_hash do |row|
resultset << row
end
resultsets << resultset
rs.free
DB.next_result
end
end
resultsets
ensure
DB.query_with_result = true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment