Tag: 存储过程

从rails中的mysql存储过程中获取多个结果集

我一直在寻找有关这方面的提示,到目前为止还没有真正的运气。 使用mysql2 gem,尝试执行返回多个结果集的存储过程使我无法返回此上下文错误中的结果。 我发现有人建议使用mysql gem(我无法找到解释两者之间的差异以及切换时可能会遇到的内容),并且我已经有了更多的进展。 这是我到目前为止所拥有的: >> db = ActiveRecord::Base.connection.raw_connection => # >> ActiveRecord::Base.connection.select_all(“CALL p_rpt_test(”, ”);”) => [{“Header”=>”Client,Project,Type,Due Date,Assigned To”}] >> db.more_results? => true >> db.next_result Mysql::Error: Commands out of sync; you can’t run this command now from (irb):3:in `next_result’ from (irb):3 有没有人知道如何让这个工作,使用mysql2或mysqlgem? 该应用程序正在运行rails 3.0.1。