Release Notes for MariaDB Connector/Node.js 3.1.0

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.1.0 was released on 2023-02-15. This release is of General Availability (GA) maturity.

Notable Changes

Time Zone Conversions

  • Instead of performing time zone conversions locally, MariaDB Connector/Node.js can set the session value of the time_zone system variable, which allows the remote server to handle time zone conversions. (CONJS-237)

    • In previous releases, time zone conversions are performed locally, which could cause issues when calling certain date and time functions.

    • Starting with this release, all time zone conversions are performed on the remote server. The timezone parameter is used to configure the behavior. The arguments have not changed, but the meaning of each argument has changed slightly:

      timezone
      (Parameter Argument)

      Description

      local

      • This is the default mode.

      • The session value of the time_zone system variable is not set, so no time zone conversion is performed.

      • This mode is only recommended when the client and server use the same time zone.

      auto

      • If the server's time zone is different from the client's time zone, the session value of the time_zone system variable is set to the client's time zone.

      • This mode is recommended when the server and client use different time zones, but the client's time zone is known to be properly configured.

      • If the client's time zone is set to an IANA time zone name and the remote server is MariaDB Server, the time zone database must be loaded on the remote server. MariaDB Server only supports IANA time zone names in the time_zone system variable when the data from the IANA time zone database (also known as tzdata or zoneinfo) has been loaded using the mariadb-tzinfo-to-sql utility.

      IANA time zone name
      (such as America/New_York)
      • The session value of the time_zone system variable is set to the provided IANA time zone name without checking the server's time zone.

      • If the remote server is MariaDB Server, the time zone database must be loaded on the remote server. MariaDB Server only supports IANA time zone names in the time_zone system variable when the data from the IANA time zone database (also known as tzdata or zoneinfo) has been loaded using the mariadb-tzinfo-to-sql utility.

      UTC offset
      (such as -04:00)
      • The session value of the time_zone system variable is set to the provided UTC offset without checking the server's time zone.

Performance Improvements

  • Performance improvements have been implemented for the internal result-set metadata parser. (CONJS-230)

  • Performance improvements have been implemented for the internal prepared statement parser. (CONJS-229)

  • Performance improvements have been implemented for the execution of command packets that have a known size, such as COM_PING, COM_STMT_CLOSE, COM_QUIT, and COM_RESET_CONNECTION. (CONJS-238)

Result-set Metadata

  • The meta property of result-set objects can be non-enumerable. (CONJS-225)

    • In previous releases, the meta property of result-set objects is always enumerable.

    • Starting with this release, the meta property of result-set objects is non-enumerable by default. To obtain the old behavior, set the metaEnumerable connection parameter to true.

TypeScript Improvements

  • With TypeScript, the batch(), execute(), and query() methods have been internally defined to have type assertions, so that applications can assign the return values without defining type assertion at the application level. (CONJS-235)

    • In previous releases, assigning the return values of the batch(), execute(), and query() methods required type assertions, which means the METHOD_CALL() AS TYPE_NAME or <TYPE_NAME> METHOD_CALL() syntax was required.

    • Starting with this release, the type assertions are defined internally using generic types.

Prepared Statement Cache

  • The prepared statement cache is more resilient at handling cases where a prepared statement has already been closed. (CONJS-240)

    • The prepared statement cache is used when the prepareCacheLength connection parameter is greater than 0.

    • In previous releases, MariaDB Connector/Node.js could attempt to use a cached prepared statement, even if it had already been closed, which could cause the ER_UNKNOWN_STMT_HANDLER error code to be raised:

      Unknown prepared statement handler (PREPARED_STATEMENT_ID) given to mysqld_stmt_execute
      
    • Starting with this release, MariaDB Connector/Node.js tracks when a prepared statement has been closed and raises the following error when a closed prepared statement is used:

      Execute fails, prepare command as already been closed
      

Issues Fixed

  • When executing a batch with a parameter that is longer than max_allowed_packet, MariaDB Connector/Node.js can lose 4 bytes of the parameter's value. (CONJS-231)

  • When the TIME data typeTIME data type is used in the binary protocol with a value that does not contain microseconds, MariaDB Connector/Node.js incorrectly decodes the value. (CONJS-236)

  • When using the Callback API, connection initialization queries are not always executed before user queries. (CONJS-239)

    • Connection initialization queries include the queries executed due to the forceVersionCheck, initSql, queryTimeout, and timezone connection parameters.

  • When a connection is killed while a query is still running, the local connection object is destroyed, but the query can sometimes continue running on the remote server. (CONJS-232)

  • With TypeScript, the metaAsArray and rowsAsArray properties are missing in the definition of the ConnectionConfig and QueryConfig interfaces. (CONJS-241)

Upgrade

MariaDB Connector/Node.js 3.1 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.1, and users should upgrade to 3.3.