"ActiveRecord::Base.connection.execute" nubee problem


#1

Is there any way of executing a full sql script, and not just one
statement?

You can do this:

ActiveRecord::Base.connection.execute(“insert into batches (name) values
‘name’”)

but not this:

ActiveRecord::Base.connection.execute(“insert into batches (name) values
‘name’; “insert into batches (name) values ‘name2’;””)


#2

How about…
statements.split(";").each do |statement|
ActiveRecord::Base.connection.execute(statement)
end


#3

No, i WANT to send in all my statements at once for quicker execution.
Is this possible?


#4

Abe wrote the following on 09.05.2006 16:23 :

No, i WANT to send in all my statements at once for quicker execution.
Is this possible?

I may be wrong but it seems to me that the difference should be
unnoticeable as you are using the same connection (the only additional
delay should be the network or system latencies between your client and
the server).
I’m wondering if the command-line SQL clients actually send a single
string to execute or instead split them before execution (the servers
might not support a single semicolon delimited string).

Lionel.