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

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 2.5.0
    • compatibility
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.