title: Why are stored procedures still not supported in Rails (3+)?
body: <p>I am familiar with the long standing love-hate relationship between Ruby on Rails, DB(MS)-drivers and Stored Procedures and I have been developing Rails applications since version 2.3.2.</p>
  
  <p>However, every once in a while a situation arises where a SP is simply a better choice than combining data on the (much slower) application level. Specifically, running reports which combines data from multiple tables is usually better suited for a SP.</p>
  
  <p>Why are stored procedures still so poorly integrated into Rails or the MySQL gem. I am currently working on a project with Rails 3.0.10 and MySQL2 gem 0.2.13 but as far as I can see, even the latest Edge Rails and MySQL gem 0.3+ still throw tantrums when you use SPs.</p>
  
  <p>The problem which has been, and still is, is that the database connection is lost after a SP is called.</p>
  
  <pre><code>&gt;&gt; ActiveRecord::Base.connection.execute("CALL stored_proc")
  =&gt; #&lt;Mysql::Result:0x103429c90&gt;
  &gt;&gt; ActiveRecord::Base.connection.execute("CALL stored_proc")
  ActiveRecord::StatementInvalid: Mysql::Error: Commands out of sync; 
  [...]
  &gt;&gt; ActiveRecord::Base.connection.active?
  =&gt; false
  &gt;&gt; ActiveRecord::Base.connection.reconnect!
  =&gt; nil
  &gt;&gt; ActiveRecord::Base.connection.execute("CALL proc01")
  =&gt; #&lt;Mysql::Result:0x1034102e0&gt;
  &gt;&gt; ActiveRecord::Base.connection.active?
  =&gt; false
  </code></pre>
  
  <p>Is this a really difficult problem to tackle, technically, or is this a design choice by Rails?</p>