Hello folks,
I’m trying to do something like:
- db = ActiveRecord::Base.establish_connection(:adapter => “mysql”,
:database => “app_development”, :username => “root”) - Cmd = File.read(‘commands.sql’) <— Command.sql contains multiple
valid SQL statement. I’ve tested this directly by piping it into MySQL
from the command line - ActiveRecord::Base.connection.execute(cmd)
This seems to not work as I would expect. My guess is that there is
some problem with the File.read parser.
Any ideas? The SQL file is pretty large. I bet the parser is doing
something to some of the input characters.
Best,
B
PS: Before anyone starts beating on the, do it the Rails way drum, the
file is big. Processes relatively large (up to several hundred million
records) tables, and works much faster when doing it in SQL directly. I
promise.