Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment