Database access.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- inTransaction → bool
-
no setter
- manager → DatabaseManager
-
no setter
- totalQueryDuration → Duration
-
Time the current request, job or command has spent in queries.
no setter
Static Methods
-
connection(
[String? name]) → Future< DatabaseDriver> -
insertGetId(
String sql, [Object? bindings = const <Object?>[]]) → Future< Object?> -
listen(
void listener(QueryExecuted event)) → void -
Calls
listenerafter every query (DB::listen): SQL, bindings, duration and connection, for debugging and slow-query logging. -
listenTransactions(
void listener(TransactionEvent event)) → void -
Calls
listenerwhen a transaction begins, commits and rolls back. -
raw(
String sql, [List< Object?> bindings = const []]) → RawExpression - Raw SQL expression for use inside the query builder.
-
select(
String sql, [Object? bindings = const <Object?>[]]) → Future< List< Map< >String, Object?> > -
Raw query;
bindingsis aListfor?or aMapfor:name. -
statement(
String sql, [Object? bindings = const <Object?>[]]) → Future< int> -
table(
String table, {String? connection}) → QueryBuilder -
Fluent query on
table(DB::table()). -
transaction<
T> (Future< T> body(), {String? connection, int attempts = 1}) → Future<T> -
whenQueryingForLongerThan(
Duration threshold, void handler(QueryExecuted event)) → void -
Calls
handleronce the current request, job or command has spent more thanthresholdin queries (DB::whenQueryingForLongerThan). -
withQueryCount<
T> (FutureOr< T> body()) → Future<(T, int, List< QueryExecuted> )> -
Runs
bodyand returns its result, how many queries it ran and the queries themselves: