mysql1 0.17.1 copy "mysql1: ^0.17.1" to clipboard
mysql1: ^0.17.1 copied to clipboard

outdated

A library for connecting to and querying MySQL & MariaDB databases.

mysql1 #

A MySQL driver for the Dart programming language. Works on Flutter and on the server.

This library aims to provide an easy to use interface to MySQL. mysql1 originated as a fork of the SQLJocky driver.

Usage #

Connect to the database

var settings = new ConnectionSettings(
  host: 'localhost', 
  port: 3306,
  user: 'bob',
  password: 'wibble',
  db: 'mydb'
);
var conn = await MySqlConnection.connect(settings);

Execute a query with parameters:

var userId = 1;
var results = await conn.query('select name, email from users where id = ?', [userId]);

Use the results:

for (var row in results) {
  print('Name: ${row[0]}, email: ${row[1]}');
});

Insert some data

var result = await conn.query('insert into users (name, email, age) values (?, ?, ?)', ['Bob', 'bob@bob.com', 25]);

An insert query's results will be empty, but will have an id if there was an auto-increment column in the table:

print("New user's id: ${result.insertId}");

Execute a query with multiple sets of parameters:

var results = await query.queryMulti(
    'insert into users (name, email, age) values (?, ?, ?)',
    [['Bob', 'bob@bob.com', 25],
    ['Bill', 'bill@bill.com', 26],
    ['Joe', 'joe@joe.com', 37]]);
481
likes
0
pub points
96%
popularity

Publisher

unverified uploader

A library for connecting to and querying MySQL & MariaDB databases.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, crypto, logging, pool

More

Packages that depend on mysql1