Release Notes for MariaDB Connector/Node.js 3.2.0
This page is part of MariaDB's Documentation.
The parent of this page is: Release Notes for MariaDB Connector/Node.js 3.2
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.2.0 was released on 2023-06-19. This release is of General Availability (GA) maturity.
Connector/Node.js 3.2 is the successor to Connector/Node.js 3.1 and is fully compatible with Connector/Node.js 3.1. Users of Connector/Node.js 3.1 should shift to Connector/Node.js 3.2.
Notable Changes
Node.js 20
MariaDB Connector/Node.js 3.2 adds support for Node.js 20. (CONJS-253)
Improved Compatibility
MariaDB Connector/Node.js 3.2 improves compatibility with the mysql/mysql2 driver. (CONJS-250)
Starting with this release, to improve compatibility, parameter values in prepared statements can be set to undefined. The value is translated to NULL when the query is executed.
Import SQL Files
MariaDB Connector/Node.js 3.2 adds 3 new methods that can be used to import SQL files, such as those created by . SQL files can also be imported using tools like . The new methods can be useful when the client is not available and cannot be installed. (CONJS-257)
The new methods are:
To create a new connection and then import an SQL file, use
importFile(options) → Promise:try { await mariadb.importFile({ host: 'mdb1.example.org', user: 'app_user', file: '/tmp/mdb-db1-data.sql' }); } catch (e) { // ... }
For
options:Specify normal connection options
Specify the path to the SQL file as
file(mandatory)
To import an SQL file using an existing connection, use
connection.importFile(options) → Promise:try { await conn.importFile({ file: '/tmp/mdb-db1-data.sql', database: 'db1' }); } catch (e) { // ... }
For
options:Specify the path to the SQL file as
file(mandatory)Specify the database to select before importing the file (optional). If it is set, the connection's current database will be saved and re-selected after the import is complete.
To import an SQL file using an existing connection pool, use
pool.importFile(options) → Promise:try { await pool.importFile({ file: '/tmp/mdb-db1-data.sql', database: 'db1' }); } catch (e) { // ... }
For
options:Specify the path to the SQL file as
file(mandatory)Specify the database to select before importing the file (optional). If it is set, the connection's current database will be saved and re-selected after the import is complete.
Each of the new methods returns a Promise. When successful, it resolves with an empty result. When a failure occurs, an Error is returned.
Issues Fixed
The TypeScript definition of the
QueryConfiginterface does not include the deprecated optionssupportBigNumbersandbigNumberStrings. (CONJS-252)When the
connectTimeoutoption is set, it is ignored in some cases. (CONJS-254)In previous releases, the timeout was ignored in the following cases:
When connecting to a Unix domain socket
When connecting to a Windows named pipe
When the socket is established sooner than the timeout, but authentication and session initialization have not completed in time
Starting with this release, the timeout is no longer ignored when connecting to a Unix domain socket or a Windows named pipe. Additionally, the timeout is cleared after authentication and session initialization have completed.
When the
pipelineoption is disabled, commands can still be pipelined, which means the next command is executed without waiting for the full response of the previous command. (CONJS-255)When using multi-authentication and pipelining,
changeUser()raises an error. (CONJS-256)Starting with this release, when
changeUser()is called, pipelining is temporarily disabled to avoid errors when there are multiple exchanges.
The
ConnectionCallbackclass does not implement all proxy methods for theEventEmitterclass. (CONJS-258)In previous releases, the
on(),once(), andlisteners()methods were implemented.Starting with this release, the following methods have been implemented:
on(eventName, listener)off(eventName, listener)once(eventName, listener)listeners(eventName)addListener(eventName, listener)eventNames()getMaxListeners()listenerCount(eventName, listener)prependListener(eventName, listener)prependOnceListener(eventName, listener)removeAllListeners(eventName, listener)removeListener(eventName, listener)setMaxListeners(n)rawListeners(eventName)
MariaDB Connector/Node.js uses a different property for SQL errors than the
mysql/mysql2driver. (CONJS-259)In previous releases, MariaDB Connector/Node.js did not support the
sqlError.sqlMessageproperty.Starting with this release, MariaDB Connector/Node.js supports the
sqlError.sqlMessageproperty as an alias for thesqlError.textproperty.
Installation
Upgrade
MariaDB Connector/Node.js 3.2 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.2, and users should upgrade to 3.3.
