Changelog
3.1.0 (Feb 2023)
Connector now set session timezone, solving issue with time function, removing needs of client side conversion.
This requires that when using timezone options, to having server TZ data filled in case client timezone differ from server.
initSql
) might not always be executed firstChangelog
3.0.2 (Oct 2022)
const prepare = await shareConn.prepare('SELECT * FROM mysql.user where host = ?');
const stream = prepare.executeStream(['localhost']);
try {
for await (const row of stream) {
console.log(row);
}
} catch (e) {
queryStream.close();
}
prepare.close();
leakDetectionTimeout
, might result in throwing wrong error with Cannot read properties of null (reading 'leaked')
prepareCacheLength
but can increase up to 2x the prepareCacheLength
value, leading to possible ER_MAX_PREPARED_STMT_COUNT_REACHEDChangelog
3.0.1 (Jul 2022)
const pool = mariadb.createPool({
host: 'mydb.com',
user: 'myUser',
connectionLimit: 5,
trace: true
});
await pool.query('wrong query');
/* will throw an error like :
SqlError: (conn:15868, no: 1064, SQLState: 42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'wrong query' at line 1
sql: wrong query - parameters:[]
at Object.module.exports.createError (errors.js:57:10)
at ...
From event:
at Function._PARAM (\integration\test-pool.js:60:18)
at …
text: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'wrong query' at line 1",
sql: 'wrong query - parameters:[]',
fatal: false,
errno: 1064,
sqlState: '42000',
code: 'ER_PARSE_ERROR'
*/
SqlError: (conn:-1, no: 45028, SQLState: HY000) retrieve connection from pool timeout after 200ms
(pool connections: active=1 idle=0 limit=1)
at Object.module.exports.createError
…
checkNumberRange
. When used in conjunction of decimalAsNumber
, insertIdAsNumber
or bigIntAsNumber
, if conversion to number is not exact, connector will throw an error [CONJS-198]. This permits easier compatibility with mysql/mysql2 and 2.x version driver version.Changelog
3.0.0 (Jan 2022)
Changelog
2.5.6 (Jan 2022)
Changelog
3.0.0-beta (11 Jun 2021)
Migrating from 2.x or mysql/mysql2 driver have some breaking changes, see dedicated part documentation.
New Connection options
|option|description|type|default|
|---:|---|:---:|:---:|
| insertIdAsNumber | Whether the query should return last insert id from INSERT/UPDATE command as BigInt or Number. default return BigInt |boolean | false |
| decimalAsNumber | Whether the query should return decimal as Number. If enable, this might return approximate values. |boolean | false |
| bigIntAsNumber | Whether the query should return BigInt data type as Number. If enable, this might return approximate values. |boolean | false |
| logger | Permit custom logger configuration. For more information, see the logger
option documentation. |mixed|
| prepareCacheLength | Define prepare LRU cache length. 0 means no cache |int| 256 |
new Connection methods
connection.prepare(sql) → Promise
: Prepares a query.connection.execute(sql[, values]) → Promise
: Prepare and Executes a query.This methods are compatible with mysql2 with some differences:
Changelog
2.5.3 (16 Feb 2021)