Created
January 12, 2011 21:08
-
-
Save jasonlyles/776882 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
require 'mysql' | |
begin | |
cnnxn = Mysql.new(hostname_or_ip,user,password,database,3306,nil,Mysql::CLIENT_MULTI_RESULTS) | |
cnnxn.query_with_result = false | |
sql = "call name_of_stored_procedure" | |
cnnxn.query sql | |
no_more_results = false | |
until no_more_results | |
begin | |
results=cnnxn.use_result | |
results.each do |x| | |
x.each_with_index do |value,i| | |
puts "#{i}: #{value}" | |
end | |
end | |
rescue Mysql::Error => e | |
no_more_results=true | |
end | |
end | |
ensure | |
cnnxn.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment