DatabaseConnection class abstract

Abstract interface for managing a database connection.

Defines the required methods to interact with the database, such as executing raw SQL, creating query builders, and handling transactions.

Implementers

Constructors

DatabaseConnection()

Properties

hashCode int
The hash code for this object.
no setterinherited
isConnected bool
Checks if the connection is currently active and usable.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

beginTransaction() Future<void>
Start a new database transaction.
commit() Future<void>
Commit the active database transaction.
connect() Future<void>
Establishes a connection to the database.
disconnect() Future<void>
Terminates the current database connection.
execute(String sql, [List bindings = const []]) Future<DatabaseResponse>
Executes a raw SQL query with optional parameter bindings.
getSchemaBuilder() SchemaBuilder
Returns a schema builder for creating and modifying database structure.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ping() Future<bool>
Sends a ping or heartbeat to check if connection is alive.
queryBuilder<T>(String table, {T modelFactory(Map<String, dynamic>)?}) QueryBuilderInterface<T>
Returns a query builder for the specified table.
rollBack() Future<void>
Rollback the active database transaction.
toString() String
A string representation of this object.
inherited
transaction<T>(Future<T> callback(), {Duration retryDelay = const Duration(milliseconds: 100), Future<void> onSuccess(T result)?, Future<void> onFailure(dynamic error)?, Future<void> onFinally()?, String? isolationLevel}) Future<T>
Executes a transactional block with retry, success/failure hooks.
unprepared(String sql) Future<void>
Execute a raw SQL statement without parameter binding.

Operators

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