mysql library Open a database

Mysql connections for SQL execution and optional typed model views.

mysql opens an owning SQL runtime. Import package:orm/sql.dart for SQL operations, and package:orm/orm.dart to add a model view of that runtime. MysqlDriver remains available for explicit driver ownership and leasing.

Classes

Mysql
Type marker for MySQL drivers and sessions.
MysqlDriver
One physical connection. Whole leases are queued, including transactions. Create additional drivers explicitly when independent concurrent leases are required. Closing drains all leases accepted before close was called.
MysqlOptions
Configuration for one owned MySQL connection.

Enums

MysqlTls
Transport encryption and server identity checks for MySQL and MariaDB.

Functions

mysql(MysqlOptions options, {void onQuery(QueryEvent)?, void onAcquire(AcquisitionEvent)?}) → Future<SqlDatabase<Mysql>>
Opens a connection and returns its owning SQL runtime.

Exceptions / Errors

MysqlFailure
A server-reported error. Numeric codes are preserved; SQLSTATE is not exposed by mysql_client_plus and is not guessed from the error message.