Uploaded image for project: 'MariaDB Connector/node.js'
  1. MariaDB Connector/node.js
  2. CONJS-143

Array parameter escaping differ from mysql/mysql2

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.0
    • Component/s: compatibility
    • 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.

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: