Release Notes for MariaDB Connector/Node.js 3.0.2
This page is part of MariaDB's Documentation.
The parent of this page is: Release Notes for MariaDB Connector/Node.js 3.0
Topics on this page:
Overview
MariaDB Connector/Node.js is the interface between Node.js applications and MariaDB Server. MariaDB Connector/Node.js enables development of Node.js applications.
MariaDB Connector/Node.js 3.0.2 was released on 2022-10-27. This release is of General Availability (GA) maturity.
Notable Changes
Added the
executeStream()
method, which uses the event-driven architecture to process rows one by one, reducing the memory needed for processing. (CONJS-222)executeStream()
is a replacement for theexecute()
method in cases where the entire result set is too large to fit into memory.The client must receive the entire result set in less time than defined by the
net_read_timeout
system variable or the read will be aborted. If the default value (30 seconds) is too short, you might need to configure a higher value.The following example shows how to call the new
executeStream()
method usingfor-await-of
(available starting with Node.js 10):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();
The following example shows how to call the new
executeStream()
method using events:const prepare = await shareConn.prepare('SELECT * FROM mysql.user where host = ?'); prepare.executeStream(['localhost']) .on("error", err => { console.log(err); //if error }) .on("fields", meta => { console.log(meta); // [ ...] }) .on("data", row => { console.log(row); }) .on("end", () => { //ended prepare.close(); });
Improved performance of the prepared statement cache. (CONJS-228)
Removed the
please-upgrade-node
package dependency. (CONJS-216)For compatibility, some error codes have been updated to match the values from MariaDB Community Server 10.9. (CONJS-213)
Issues Fixed
The
name
metadata column can become corrupted. (CONJS-223)When a connection is re-used with a connection pool, the session timezone is reset, which results in incorrect dates and times. (CONJS-211)
When a connection pool is used and the
leakDetectionTimeout
parameter is set to a non-zero value, an error is raised. (CONJS-212)In previous releases, the following error is raised:
/root/node_modules/mariadb/lib/pool.js:439 if (value.leaked) counter++; ^ TypeError: Cannot read properties of null (reading 'leaked')
When connecting to a MySQL 8.0 server with
caching_sha2_password
, fast authentication using the server-side cache does not work. (CONJS-217)In previous releases, the implementation of
caching_sha2_password
in Connector/Node.js requires the full authentication process to be performed each time a user connects.Starting with this release, the implementation of
caching_sha2_password
in Connector/Node.js only requires the full authentication process to be performed the first time a user connects, and the user's subsequent connections can be authenticated against the server-side cache.
When batch inserts are performed or the
pool.batch()
method is called, theprepareCacheLength
parameter does not properly restrict the size of the prepared statement cache. (CONJS-219)In previous releases, this could cause the number of prepared statements to exceed
max_prepared_stmt_count
, which could cause theER_MAX_PREPARED_STMT_COUNT_REACHED
error to be raised.Starting with this release, the
prepareCacheLength
parameter properly restricts the size of the prepared statement cache.
When the
idleTimeout
parameter is set to0
, the idle connection timeout is not disabled and is set to 30 minutes instead. (CONJS-227)metaAsArray
,checkNumberRange
, andpool.closed
TypeScript options are not available. (CONJS-226, CONJS-224, CONJS-214)When a prepared statement is executed after being closed, a
ER_UNKNOWN_STMT_HANDLER
error code is raised, which does not clearly mention the cause of the problem. (CONJS-215)In previous releases, the following error is raised:
'Unknown prepared statement handler (1) given to mysqld_stmt_execute'
Starting with this release, the following error is raised:
'Execute fails, prepare command has already been closed'
Installation
Upgrade
MariaDB Connector/Node.js 3.0 is fully compatible with MariaDB Connector/Node.js 3.3. As a new fully compatible major version, MariaDB Connector/Node.js 3.3 supersedes MariaDB Connector/Node.js 3.0, and users should upgrade to 3.3.