@sqb/mysql
v6.0.9
Published
SQB adapter for the mysql2 driver
Readme
About SQB
SQB is an extensible, multi-dialect SQL query builder and Database connection wrapper for NodeJS.
About @sqb/mysql
This package is a SQB Adapter for MySQL, backed by the mysql2
driver. It uses mysql2's named placeholder support (:name), which matches the parameter
syntax @sqb/builder generates by default.
MySQL has no RETURNING clause, so INSERT ... RETURNING / UPDATE ... RETURNING are
emulated with a follow-up SELECT (using LAST_INSERT_ID() for inserts, and the original
WHERE clause for updates).
Installation
$ npm install @sqb/mysql --saveUsage
import '@sqb/mysql';
import { SqbClient } from '@sqb/connect';
const client = new SqbClient({
driver: 'mysql2',
host: 'localhost',
port: 3306,
user: 'root',
database: 'mydb',
});Node Compatibility
- node >= 20.x
License
SQB is available under MIT license.
