I use following:
cnn = Mysql2::Client.new(username: 'root', password: 'root', hostname: 'localhost', port: 3306, database: 'ro_cmds_plus_prod', flags: Mysql2::Client::FOUND_ROWS | Mysql2::Client::MULTI_STATEMENTS
)
r = cnn.query('select "line 1"; select "line 2";').to_a
puts "r:#{r} ---- #{File.basename __FILE__}:#{__LINE__}"
and get
r:[{"line 1"=>"line 1"}] ---- exe.rb:17
My question is how to get
r:[{"line 2"=>"line 2"}] ---- exe.rb:17
答案 0 :(得分:-1)
使用Client对象的#next_result方法。参看https://github.com/brianmario/mysql2#multiple-result-sets