DatabaseConnection class

A connection to the database. In most cases the Database db object in the Session object should be used when connecting with the database.

Constructors

DatabaseConnection(DatabasePoolManager _poolManager)
Creates a new database connection from the configuration. For most cases this shouldn't be called directly, use the db object in the Session to access the database.

Properties

hashCode int
The hash code for this object.
no setterinherited
legacy ↔ DatabaseConnectionLegacy
Access to legacy database methods.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

count<T extends TableRow>(Session session, {Expression? where, int? limit, Transaction? transaction}) Future<int>
For most cases use the corresponding method in Database instead.
delete<T extends TableRow>(Session session, List<T> rows, {Transaction? transaction}) Future<List<int>>
For most cases use the corresponding method in Database instead.
deleteRow<T extends TableRow>(Session session, T row, {Transaction? transaction}) Future<int>
For most cases use the corresponding method in Database instead.
deleteWhere<T extends TableRow>(Session session, Expression where, {Transaction? transaction}) Future<List<int>>
For most cases use the corresponding method in Database instead.
execute(Session session, String query, {int? timeoutInSeconds, Transaction? transaction}) Future<int>
For most cases use the corresponding method in Database instead.
find<T extends TableRow>(Session session, {Expression? where, int? limit, int? offset, Column? orderBy, bool orderDescending = false, List<Order>? orderByList, Include? include, Transaction? transaction}) Future<List<T>>
For most cases use the corresponding method in Database instead.
findById<T extends TableRow>(Session session, int id, {Transaction? transaction, Include? include}) Future<T?>
For most cases use the corresponding method in Database instead.
findFirstRow<T extends TableRow>(Session session, {Expression? where, int? offset, Column? orderBy, List<Order>? orderByList, bool orderDescending = false, Transaction? transaction, Include? include}) Future<T?>
For most cases use the corresponding method in Database instead.
insert<T extends TableRow>(Session session, List<T> rows, {Transaction? transaction}) Future<List<T>>
For most cases use the corresponding method in Database instead.
insertRow<T extends TableRow>(Session session, T row, {Transaction? transaction}) Future<T>
For most cases use the corresponding method in Database instead.
mappedResultsQuery(Session session, String query, {int? timeoutInSeconds, Transaction? transaction}) Future<List<Map<String, Map<String, dynamic>>>>
For most cases use the corresponding method in Database instead.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(Session session, String query, {int? timeoutInSeconds, Transaction? transaction, Map<String, dynamic>? substitutionValues = const {}}) Future<PostgreSQLResult>
For most cases use the corresponding method in Database instead.
testConnection() Future<bool>
Tests the database connection. Throws an exception if the connection is not working.
toString() String
A string representation of this object.
inherited
transaction<R>(TransactionFunction<R> transactionFunction, {RetryOptions? retryOptions, FutureOr<R> orElse()?, FutureOr<bool> retryIf(Exception exception)?}) Future<R>
For most cases use the corresponding method in Database instead.
update<T extends TableRow>(Session session, List<T> rows, {List<Column>? columns, Transaction? transaction}) Future<List<T>>
For most cases use the corresponding method in Database instead.
updateRow<T extends TableRow>(Session session, T row, {List<Column>? columns, Transaction? transaction}) Future<T>
For most cases use the corresponding method in Database instead.

Operators

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