Forum: Ruby on Rails Mysql stored procedures from Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tomas Larsson (Guest)
on 2006-03-28 22:31
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
Terry Pritchard (Guest)
on 2006-04-11 23:53
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
Ryan P. (Guest)
on 2006-04-12 01:00
(Received via mailing list)
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
This topic is locked and can not be replied to.