sqljocky5

Creator: coderz1093

Last updated:

0 purchases

sqljocky5 Image
sqljocky5 Images

Languages

Categories

Add to Cart

Description:

sqljocky5

SQLJocky5 #
MySQL client for Dart.
Creating a connection #
var s = ConnectionSettings(
user: "root",
password: "dart_jaguar",
host: "localhost",
port: 3306,
db: "example",
);
var conn = await MySqlConnection.connect(s);
copied to clipboard
Closing a connection #
await conn.close();
copied to clipboard
Execute a query #
Results results = await conn.execute('select name, email from users');
copied to clipboard
Results is an iterable of Row. Columns can be accessed from Row using
integer index or by name.
results.forEach((Row row) {
// Access columns by index
print('Name: ${row[0]}, email: ${row[1]}');
// Access columns by name
print('Name: ${row.name}, email: ${row.email}');
});
copied to clipboard
Prepared query #
await conn.prepared('insert into users (name, email, age) values (?, ?, ?)',
['Bob', '[email protected]', 25]);
copied to clipboard
Insert id #
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}");
copied to clipboard
Prepared multiple queries #
var results = await query.preparedMulti(
'insert into users (name, email, age) values (?, ?, ?)',
[['Bob', '[email protected]', 25],
['Bill', '[email protected]', 26],
['Joe', '[email protected]', 37]]);
copied to clipboard
Transactions #
Transaction trans = await pool.begin();
try {
var result1 = await trans.execute('...');
var result2 = await trans.execute('...');
await trans.commit();
} catch(e) {
await trans.rollback();
}
copied to clipboard
Safe transaction #
await pool.transaction((trans) {
var result1 = await trans.execute('...');
var result2 = await trans.execute('...');
});
copied to clipboard
TODO #

Compression
COM_SEND_LONG_DATA
CLIENT_MULTI_STATEMENTS and CLIENT_MULTI_RESULTS for stored procedures
Better handling of various data types, especially BLOBs, which behave differently when using straight queries and prepared queries.
Implement the rest of mysql's commands
Handle character sets properly? Currently defaults to UTF8 for the connection character set. Is it
necessary to support anything else?
Improve performance where possible
Geometry type
Decimal type should probably use a bigdecimal type of some sort
MySQL 4 types (old decimal, anything else?)
Test against multiple mysql versions

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.