Dart DocumentationsqljockyTransaction

Transaction abstract class

Start a transaction by using ConnectionPool.startTransaction. Once a transaction is started it retains its connection until the transaction is committed or rolled back. You must use the commit and rollback methods to do this, otherwise the connection will not be released back to the pool.

abstract class Transaction extends QueriableConnection {
 /**
  * Commits the transaction and released the connection. An error will be thrown
  * if any queries are executed after calling commit.
  */
 Future commit();

 /**
  * Rolls back the transaction and released the connection. An error will be thrown
  * if any queries are executed after calling rollback.
  */
 Future rollback();
}

Extends

QueriableConnection > Transaction

Methods

abstract Future commit() #

Commits the transaction and released the connection. An error will be thrown if any queries are executed after calling commit.

abstract Future<Query> prepare(String sql) #

inherited from QueriableConnection

Prepares a query with the given sql. Returns a [Future] that completes when the query has been prepared.

abstract Future<Results> prepareExecute(String sql, List<dynamic> parameters) #

inherited from QueriableConnection

Prepares and executes the sql with the given list of parameters. Returns a Future<Results> that completes when the query has been executed.

abstract Future<Results> query(String sql) #

inherited from QueriableConnection

Executes the sql query, returning a Future<Results> that completes when the results start to become available.

abstract Future rollback() #

Rolls back the transaction and released the connection. An error will be thrown if any queries are executed after calling rollback.