Driver<B extends Backend> class abstract interface Independent SQL drivers

Owns or borrows connection resources for a specific engine B.

Implementations lease one connection for each run callback and return it after the callback settles. The driver contract does not imply that a callback is a transaction: use a SQL runtime or explicitly issue transaction commands.

Future<int> countUsers(Driver<Sqlite> driver) => driver.run((connection) async {
  final result = await connection.execute(SqlCommand('SELECT COUNT(*) FROM users'));
  return result.rows.single.single as int;
});
Implementers

Properties

capabilities Capabilities
Features and limits exposed by this adapter and its actual backend.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Rejects new work and releases resources owned by this driver.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run<R>(Future<R> action(SqlConnection)) Future<R>
Leases one connection until action completes or throws.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited