dox_mysql_native 3.0.0-alpha.4
dox_mysql_native: ^3.0.0-alpha.4 copied to clipboard
Fast native MySQL and MariaDB client for Dart, the default MySQL driver of the Dox ORM. Rust (mysql_async) runs the pool and a prepared statement cache. Dart gets typed rows.
dox_mysql_native #
A fast MySQL and MariaDB client for Dart. It is the default MySQL driver of the Dox ORM. Rust (mysql_async) owns the connections. Your code stays in Dart.
Values come back with the same Dart types as with the Dox ORM on
mysql_dart, and errors are the same MySQLServerException class.
import 'package:dox_mysql_native/dox_mysql_native.dart';
void main() async {
MysqlNativePool pool = MysqlNativePool.open(
host: 'localhost',
user: 'root',
password: 'password',
database: 'app',
);
MysqlNativeResult result = await pool.query(
'SELECT id, name FROM users WHERE id = ?',
parameters: <Object?>[1],
);
print(result.rows);
}
With the Dox ORM you do not add this package. dox_orm depends on it and
uses it by default. Set DOX_DB_DRIVER=dart to use the Dart driver.
- Works with MySQL 8.4 (
caching_sha2_password) and MariaDB 11. - The build hook downloads a ready-built library when one exists for your
system. Else it builds it with
cargo(install Rust with rustup). - Use
dart run,dart testordart build cli.dart compile exedoes not run build hooks.
More: Native MySQL driver.