Hi,
I'm implementing database/sql/driver for Oracle with ODPI-C.
My first attemt for BeginTx was to create a new connection and return that - as Oracle manages transactions at the connection level, this seemed the only option.
Now I see that the database/sql.DB.BeginTx returns an sql.Tx with the same db object that it got, and my printfs says that everything executed on this Tx object uses the original (not-in-a-transaction) driver.Conn!
My temporary workaround is to just mark the connection as "in-transaction" in BeginTx, and this works, but means I "switch" the connection's mode,
thus a BeginTx cannot follow a BeginTx before Rollback/Commit - no nested transactions.
Which way is closer to what I shall implement in database/sql/driver? Which was intended?
I acknowledge that probably I was wrong, and the second approach is the better, but I don't know for sure.
Thanks,
Tamás Gulácsi