MysqlDatabase class final

A Preview MySQL/MariaDB database backed by one connection or a lazy pool.

Implemented types

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

atomicWrite(List<BoundSql> statements) → Future<List<SqlWriteResult>>
Executes transaction-safe DML statements as one atomic write batch.
override
close() → Future<void>
Releases resources owned by this database.
override
execute(BoundSql statement) → Future<SqlWriteResult>
Executes one write statement.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query<T>(BoundSql statement, T decode(SqlRow row)) → Future<List<T>>
Executes a row-returning statement and decodes every row in order.
override
toString() → String
A string representation of this object.
inherited
transaction<T>(Future<T> action(SqlExecutor transaction)) → Future<T>
Runs action inside one database transaction.
override

Operators

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

Static Methods

open({required String host, int port = 3306, required String database, required String username, required String password, bool useTls = true, SecurityContext? tlsContext, bool allowPublicKeyRetrieval = false, Duration connectTimeout = const Duration(seconds: 10), String collation = 'utf8mb4_general_ci', int preparedStatementCacheSize = 32}) → Future<MysqlDatabase>
Opens and owns one MySQL or MariaDB connection.
pool({required String host, int port = 3306, required String database, required String username, required String password, int maxConnections = 4, int maxPendingOperations = 32, Duration queueTimeout = const Duration(seconds: 10), bool useTls = true, SecurityContext? tlsContext, bool allowPublicKeyRetrieval = false, Duration connectTimeout = const Duration(seconds: 10), String collation = 'utf8mb4_general_ci', int preparedStatementCacheSize = 32}) → MysqlDatabase
Creates and owns a lazy MySQL or MariaDB connection pool.