Closed heretic13 closed 7 years ago
Table not created after transaction. If I comment transaction, it's working.
This is normal?
maybe problem in this
connection.go:
func (fc *firebirdsqlConn) Begin() (driver.Tx, error) { fc.isAutocommit = false }
func (fc *firebirdsqlConn) Exec(query string, args []driver.Value) (result driver.Result, err error) { if fc.isAutocommit { fc.tx.Commit() fc.tx, err = newFirebirdsqlTx(fc.wp, fc.isolationLevel) } }
After transaction rollback or commit nothing changed in connection state (isAutocommit value).
Thanks, I realize something wrong.
I think that changing isAutcommit state in Begin() is evil. But still I don't know how to fix this problem now. Wait for several days. (or send pull request).
I have been modify and refactoring, and add test codes. https://github.com/nakagami/firebirdsql/blob/master/transaction_test.go
I think, this problem fixed. Please test it with master HEAD.
I checked. This solution does not work. Tested by example, which I quoted above. Begin () makes the transaction with property tx.isAutocommit = false. When I do a tx.Commit() - nothing changes.
If I do then conn.Exec ():
if fc.isAutocommit && fc.tx.isAutocommit { fc.tx.Commit () }
fc.isAutocommit = true fc.tx.isAutocommit = false
fc.tx.Commit () - not performed
I think that once executed tx.Commit () or tx.Rollback () the connection must be changed fc.tx.isAutocommit flag or forget the old transaction and create a new transaction for its own needs (as is done in newFirebirdsqlConn ())
Thanks, I think I wrote regression test and fix code.
Restart transaction in Commit() and Rollback() Is this OK ?
Hmm... It's working!
thanks
`package main
import ( "database/sql" "log"
)
func main() {
}`