mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 23:28:39 +03:00
crdb: fix transactions handling
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user