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

Charset change using parameterized query fails with "Uncaught TypeError: opts.emit is not a function"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.1
    • Component/s: other
    • Labels:
      None

      Description

      see https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/199

      (async () => {
          const { strictEqual } = require("assert");
          const Maria = require("mariadb");
          const pool = Maria.createPool({
          	user: "user",
          	password: "password",
          	host: "host"
          });
          
          const query = "SET NAMES 'utf8'";
          
          // Using string directly works as expected
          const result1 = await pool.query(query); 
          strictEqual(result1.constructor.name, "OkPacket");
          console.log("result 1 ok");
       
          // Using { sql: string } fails
          const result2 = await pool.query({ sql: query }); 
          strictEqual(result2.constructor.name, "OkPacket");
          console.log("result 2 ok");
      })();
      

      At the same time, with MariaDB server 10.6, changing to utf8 might result in "Error: unknown charset : 'utf8mb3'"

        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:

                Git Integration

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