[CONJS-143] Array parameter escaping differ from mysql/mysql2 Created: 2020-08-18  Updated: 2020-10-13  Resolved: 2020-10-13

Status: Closed
Project: MariaDB Connector/node.js
Component/s: compatibility
Affects Version/s: None
Fix Version/s: 2.5.0

Type: Task Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

javascript driver permit passing array parameters.

for mysql2 and mysql, Arrays are turned into list, e.g. ['a', 'b'] turns into 'a', 'b'
This permits easy use for In statement for example:

const lst = ['a', 'b'];
conn.query("SELECT 'a' in (?)", [lst]).then(...)

mariadb handle array parameter with parenthesis , so ['a', 'b'] turns into ('a', 'b')
so this will result in SELECT 'a' IN (('a', 'b')); that will throw an error (4078) : Illegal parameter data types varchar and row for operation '='

workaround is to remove parenthesis ('' => '?'), but correction is to remove the added parenthesis.


Generated at Thu Feb 08 03:23:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.