mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 09:00:27 +00:00
crdb: fix transactions handling
This commit is contained in:
parent
6bc5c64a3a
commit
db274f1093
1 changed files with 4 additions and 4 deletions
|
@ -1081,15 +1081,15 @@ func sqlCommonExecSQLAndUpdateDBVersion(dbHandle *sql.DB, sqlQueries []string, n
|
|||
}
|
||||
|
||||
func sqlCommonExecuteTx(ctx context.Context, dbHandle *sql.DB, txFn func(*sql.Tx) error) error {
|
||||
if config.Driver == CockroachDataProviderName {
|
||||
return crdb.ExecuteTx(ctx, dbHandle, nil, txFn)
|
||||
}
|
||||
|
||||
tx, err := dbHandle.BeginTx(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if config.Driver == CockroachDataProviderName {
|
||||
return crdb.ExecuteTx(ctx, dbHandle, nil, txFn)
|
||||
}
|
||||
|
||||
err = txFn(tx)
|
||||
if err != nil {
|
||||
// we don't change the returned error
|
||||
|
|
Loading…
Reference in a new issue