I have incorporated ActiveRecord into a script I am writing to process some data in a MySQL database. In my development environment, using Mac OS X, everything works fine, however, when I attempt to deploy the script in a Linux environment, I keep getting the following error:
/activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb:623:in `select': undefined method `more_results' for #<Mysql:0x915976c> (NoMethodError)
The code where this error is occuring is pasted below, specifically the second to last line that has been commented.
def select(sql, name = nil)
@connection.query_with_result = true
result = execute(sql, name)
rows = []
result.each_hash { |row| rows << row }
result.free
@connection.more_results && @connection.next_result # invoking stored procedures with CLIENT_MULTI_RESULTS requires this to tidy up else connection will be dropped
rows
end
The history of why this code was introduced can be viewed at https://rails.lighthouseapp.com/projects/8994/tickets/3151-mysql-adapter-update-to-enable-use-of-stored-procedures#ticket-3151-33
That said, I am still uncertain how to fix this error without just commenting out that problematic line. I am not using any stored procedures so it is not a significant issue, however, I would like to implement a more extensible fix.
I am using the following gems in both environments.
activerecord (3.0.0) mysql (2.8.1)
Thanks in advance for any thoughts on what might be going on here!