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.
GNU Lesser General Public License v2.1
366
stars
91
forks
source link
Using `SET NAMES` in 3.0.0 fails with `TypeError` #199
In mariadb version 2.5.2, the snippet passes, whereas in 3.0.0, the following error is thrown when attempting to initialize result2:
Uncaught TypeError: opts.emit is not a function
at Query.parseOkPacket (VM195 command.js:142:24)
at Query.readOKPacket (VM214 parser.js:108:27)
at Query.readResponsePacket (VM214 parser.js:46:21)
at PacketInputStream.receivePacketBasic (VM164 packet-input-stream.js:76:9)
at PacketInputStream.onData (VM164 packet-input-stream.js:139:20)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Using other meta SQL commands (such as USE database) seems to cause no issues. Other arguments for SET NAMES fail similarly to utf8mb4.
Tested on NodeJS versions 12.22.9, 14.15.0, 16.14.2, 18.0.0, with identical results.
When using the
SET NAMES
statement inside of apool.query({ sql: query })
call, the execution fails with TypeErroropts.emit is not a function
.Consider the following script:
In
mariadb
version2.5.2
, the snippet passes, whereas in3.0.0
, the following error is thrown when attempting to initializeresult2
:Using other meta SQL commands (such as
USE database
) seems to cause no issues. Other arguments forSET NAMES
fail similarly toutf8mb4
.Tested on NodeJS versions
12.22.9
,14.15.0
,16.14.2
,18.0.0
, with identical results.