Commit commits the transaction and releases the writer mutex if this is a write transaction. Also promotes any transaction-prepared statements to the DB cache for future use. On failure, the transaction remains active - caller must call Rollback() to release the mutex.
()
| 401 | // Also promotes any transaction-prepared statements to the DB cache for future use. |
| 402 | // On failure, the transaction remains active - caller must call Rollback() to release the mutex. |
| 403 | func (t *Tx) Commit() error { |
| 404 | err := t.tx.Commit() |
| 405 | if err == nil { |
| 406 | // Commit succeeded - promote statements to cache |
| 407 | t.promoteStatementsToCache() |
| 408 | // Release mutex only on successful commit (for write transactions) |
| 409 | if t.unlockFn != nil { |
| 410 | t.unlockOnce.Do(t.unlockFn) |
| 411 | } |
| 412 | } |
| 413 | return err |
| 414 | } |
| 415 | |
| 416 | // Rollback rolls back the transaction and releases the writer mutex if this is a write transaction. |
| 417 | // Always releases the mutex since the transaction is done (either rolled back successfully, |
nothing calls this directly
no test coverage detected