openTransaction method
Implementation
@override
Future<DBMySqlConnectionWrapper> openTransaction(Transaction transaction) {
var contextCompleter = Completer<DBMySqlConnectionWrapper>();
var result = executeWithPool(
(connection) {
return connection.openTransaction((transactionWrap) {
contextCompleter.complete(transactionWrap);
return transaction.transactionFuture.then(
(res) => resolveTransactionResult(res, transaction, connection),
onError: (e, s) {
cancelTransaction(transaction, connection, e, s);
throw e;
},
);
});
},
validator: (c) => !transaction.isAborted,
onError: (e, s) => transaction.notifyExecutionError(
e,
s,
errorResolver: resolveError,
debugInfo: () => transaction.toString(withExecutedOperations: false),
),
);
transaction.transactionResult = result;
return contextCompleter.future;
}