MySqlDatabase class

A MySQL implementation of SqlDatabase using a connection pool.

Extends SqlDatabase so insert, select, update, and delete are inherited — only rawQuery and transaction are MySQL-specific.

Uses MySQLConnectionPool from mysql_client_plus. PoolConfig.minConnections and PoolConfig.idleTimeout are not supported by the underlying pool and are silently ignored.

Inheritance
Available extensions

Constructors

MySqlDatabase(DbConfig config)

Properties

config DbConfig
finalinherited
hashCode int
The hash code for this object.
no setterinherited
paramStyle DbParamStyle
The SQL parameter placeholder style used by this driver.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes the database connection.
override
connect() Future<void>
Establishes a connection to the database.
override
delete(String table, {required Map<String, dynamic> where}) Future<DbResult>
Deletes one or more rows from the specified table.
inherited
insert(String table, Map<String, dynamic> data) Future<DbResult>
Inserts a new row into the specified table.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ph(String key) String
Returns the placeholder string for key based on paramStyle.
inherited
query(String table) QueryBuilder

Available on DartApiDB, provided by the DbQueryExtension extension

Returns a QueryBuilder targeting table.
rawQuery(String query, {Map<String, dynamic>? values}) Future<DbResult>
Executes a raw SQL query and returns the result.
override
select(String table, {Map<String, dynamic>? where, int? limit, int? offset}) Future<DbResult>
Retrieves data from the specified table.
inherited
toString() String
A string representation of this object.
inherited
transaction<T>(Future<T> callback(DbTransaction tx)) Future<T>
Runs callback inside a database transaction.
override
update(String table, Map<String, dynamic> data, {required Map<String, dynamic> where}) Future<DbResult>
Updates one or more rows in the specified table.
inherited

Operators

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