Hi all, I know stored procedures are considered evil around, but there are times when you just have to use them. In the project I''m working on, I needed to call a mysql5 stored procedure, but I only got an error message saying "ActiveRecord::StatementInvalid: Mysql::Error: PROCEDURE vc.testsp can''t return a result set in the given context: call testsp()" I found out from here: http://bugs.mysql.com/bug.php?id=2658 that mysql needs the flag CLIENT_MULTI_RESULTS set if you want to be able to return result sets from stored procedures. The problem is that mysql_adapter.rb doesn''t pass the flag parameter to the mysql connect function. When I hacked it in there myself, things worked perfectly. Am I going to about this the wrong way? Even though things work fine now, I don''t want to have to hack this fix back in when new versions of rails are released... Cheers, tomas -- Posted via http://www.ruby-forum.com/.
Tomas Larsson wrote:> Hi all, > > I know stored procedures are considered evil around, but there are times > when you just have to use them. In the project I''m working on, I needed > to call a mysql5 stored procedure, but I only got an error message > saying "ActiveRecord::StatementInvalid: Mysql::Error: PROCEDURE > vc.testsp can''t return a result set in the given context: call testsp()" > I found out from here: http://bugs.mysql.com/bug.php?id=2658 that mysql > needs the flag CLIENT_MULTI_RESULTS set if you want to be able to return > result sets from stored procedures. The problem is that mysql_adapter.rb > doesn''t pass the flag parameter to the mysql connect function. When I > hacked it in there myself, things worked perfectly. > > Am I going to about this the wrong way? Even though things work fine > now, I don''t want to have to hack this fix back in when new versions of > rails are released... > > Cheers, > tomasCould you possibly post the changes you made to mysql_adapter.rb? I need to get a result set from a stored procedure into RoR too! Thanks -T -- Posted via http://www.ruby-forum.com/.
Mabye the changes you made could be patched into the core file for future releases of RoR. I''d also suggest you post a diff of the file or just the changes you made to the adapter. Best, Ryan On 4/11/06, Terry Pritchard <terry.pritchard@rogers.com> wrote:> > Tomas Larsson wrote: > > Hi all, > > > > I know stored procedures are considered evil around, but there are times > > when you just have to use them. In the project I''m working on, I needed > > to call a mysql5 stored procedure, but I only got an error message > > saying "ActiveRecord::StatementInvalid: Mysql::Error: PROCEDURE > > vc.testsp can''t return a result set in the given context: call testsp()" > > I found out from here: http://bugs.mysql.com/bug.php?id=2658 that mysql > > needs the flag CLIENT_MULTI_RESULTS set if you want to be able to return > > result sets from stored procedures. The problem is that mysql_adapter.rb > > doesn''t pass the flag parameter to the mysql connect function. When I > > hacked it in there myself, things worked perfectly. > > > > Am I going to about this the wrong way? Even though things work fine > > now, I don''t want to have to hack this fix back in when new versions of > > rails are released... > > > > Cheers, > > tomas > > Could you possibly post the changes you made to mysql_adapter.rb? I > need to get a result set from a stored procedure into RoR too! Thanks > -T > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ryan Prins rprins@gmail.com http://www.lazyi.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060411/43b87823/attachment.html