>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
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
>
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
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
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
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
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
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
8 matches
Mail list logo