title: Is it possible to call a MySQL stored procedure from Ruby?
body: <p>When I try to call a stored procedure from Rails, I get this exception:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>There is a page in the <a href="http://wiki.rubyonrails.org/rails/pages/StoredProceduresInMySql" rel="nofollow noreferrer">Rails Wiki that discusses a patch</a> for the MySQL adapter that resolves this issue, but it's out-of-date and doesn't seem to work anymore.</p>
  
  <p>The configuration code enables stored procedures correctly, but it still has the issue with the connection getting out of sync after a stored procedure call and the new <code>call_sp</code> method doesn't work anymore.</p>
  
  <p>Any suggestions for how to get this working?</p>
  
  <p>This is the code I'm using:</p>
  
  <pre><code>ActiveRecord::Base.connection("call storedproc()")
  </code></pre>
  
  <p>It throws the same exception whether <code>storedproc()</code> returns any results or not.</p>