相关疑难解决方法(0)

是否可以从Ruby调用MySQL存储过程?

当我尝试从Rails调用存储过程时,我得到以下异常:

ActiveRecord::StatementInvalid: Mysql::Error: PROCEDURE pipeline-ws_development.match_save_all can't return a result set in the given context: call match_save_all()
    from /Users/otto/Projects/Futures/src/pipeline-ws/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log'
    from /Users/otto/Projects/Futures/src/pipeline-ws/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:281:in `execute'
    from (irb):3
Run Code Online (Sandbox Code Playgroud)

Rails Wiki中有一个页面讨论了解决此问题的MySQL适配器的补丁,但它已经过时并且似乎不再起作用了.

配置代码正确地启用了存储过程,但是在存储过程调用之后连接失去同步仍然存在问题,并且新call_sp方法不再起作用.

有关如何使其工作的任何建议?

这是我正在使用的代码:

ActiveRecord::Base.connection("call storedproc()")
Run Code Online (Sandbox Code Playgroud)

无论是否storedproc()返回任何结果,它都会抛出相同的异常.

mysql stored-procedures ruby-on-rails

5
推荐指数
1
解决办法
8274
查看次数

标签 统计

mysql ×1

ruby-on-rails ×1

stored-procedures ×1