Created
October 26, 2009 18:54
-
-
Save vroy/218920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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