All,
I didn’t finish writing this before I posted the previous post. Sigh.
Using Rails 1.1.6
AR against MS SQL Server (ODBC mode).
I need to do some fancy bulk inserting of data, which I need to ensure
is within a transaction. But as I think about it, it isn’t clear to me
whether what I want to do will work within standard AR.
If I do something like this:
MyClass.transaction do
MyClass.connection.execute(“arbitrary SQL”)
…
MyClass.connection.execute(“arbitrary SQL”)
end
will this all use the same connection and actually work within the
transaction, even though I’m explicitly doing execute on
MyClass.connection within the transaction? I’m concerned that using
MyClass.connection implicitly opens a new connection.
Can anyone verify whether or not this is the case?
If I can’t rely on this, I think I should be able to just write up my
SQL with explicit SQL-level transaction management within it, and pass
that to one call to MyClass.connection.execute.
Thanks,
Wes