MariaDB Connector/Node.js is used to connect applications developed on Node.js to MariaDB and MySQL databases. MariaDB Connector/Node.js is LGPL licensed.
LGPL-2.1 License
Bot releases are hidden (Show)
Published by dbart 4 months ago
Published by dbart 7 months ago
Published by dbart 10 months ago
Published by dbart about 1 year ago
Published by dbart about 1 year ago
infileStreamFactory
addition for compatibilityPublished by dbart over 1 year ago
importFile(options) → Promise
connection.importFile({file:'...', 'database': '...'}) → Promise
pool.importFile({file:'...', 'database': '...'}) → Promise
example:
await conn.importFile({
file: '/tmp/someFile.sql',
database: 'myDb'
});
Published by dbart over 1 year ago
Published by dbart over 1 year ago
Published by dbart over 1 year ago
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 firstPublished by dbart almost 2 years ago
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_REACHEDPublished by dbart about 2 years ago
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.Published by dbart over 2 years ago
Published by dbart over 2 years ago
Published by dbart almost 3 years ago
Notable change:
resetAfterUse
default valuestream
optionPublished by dbart almost 3 years ago
Published by dbart over 3 years ago
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:
Published by dbart over 3 years ago
Published by rusher over 3 years ago
This version is a correction release (Stable (GA)).
Published by rusher almost 4 years ago
This version is a correction release (Stable (GA)).
permitLocalInfile
option and some initial commandsdocumentation improvement
Published by rusher almost 4 years ago
This version is a correction release (Stable (GA)).