[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2010-03-23 Thread Horace Ho
>From the script/console: $ script/console Loading development environment (Rails 2.3.5) /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement >> ActiveRe

[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2009-09-06 Thread Justin Bailey
E. Litwin wrote: > I've still had to hack the mysql_adapter to set a flag upon opening > the MySQL database connection in order to be able to use SPs: > > module ActiveRecord > class Base > def self.mysql_connection(config) >... ># last line of method - add 65536 flag >

[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2009-08-28 Thread E. Litwin
Try extending mysql_adapter.rb and add this method: def select_sp(sql, name = nil) rows = select(sql, name = nil) while (@connection.more_results?()) @connection.next_result() end return rows end Then call the SP using this method from your

[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2009-08-28 Thread Chris Dekker
nas wrote: > Check this > > http://nasir.wordpress.com/2007/12/03/stored-procedures-and-rails > > On Aug 27, 3:09�pm, Chris Dekker Thanks, but that link did not help me. For MYSQL it doesn't even work. Stored procedures are called through 'CALL', not 'EXECUTE'. Also as I wrote in my third p

[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2009-08-28 Thread nas
Check this http://nasir.wordpress.com/2007/12/03/stored-procedures-and-rails On Aug 27, 3:09 pm, Chris Dekker wrote: > Adding the 65536 flag seems to allow me to gather a resultset from the > stored procedure, yet my commands go out of sync. Running any query > (even a simple Model.first) after

[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2009-08-27 Thread Chris Dekker
Adding the 65536 flag seems to allow me to gather a resultset from the stored procedure, yet my commands go out of sync. Running any query (even a simple Model.first) after running a Stored Proc that returns results gives this error: ActiveRecord::StatementInvalid: Mysql::Error: Commands out o

[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2009-08-26 Thread Margareth Florián
This works for me: ActiveRecord::Base.connection.execute("call SP_name (#{param1}, #{param2}, ... )") 2009/8/24 E. Litwin > > I've still had to hack the mysql_adapter to set a flag upon opening > the MySQL database connection in order to be able to use SPs: > > module ActiveRecord > clas

[Rails] Re: Stored Procedures MYSQL and Rails 2.3.2

2009-08-24 Thread E. Litwin
I've still had to hack the mysql_adapter to set a flag upon opening the MySQL database connection in order to be able to use SPs: module ActiveRecord class Base def self.mysql_connection(config) ... # last line of method - add 65536 flag ConnectionAdapters::MysqlAdapter