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

When using connection with callback, pre-commands might be executed after requested query

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 3.1.0
    • other
    • None

    Description

      There can be multiple pre-commands:

      • setting timezone (option `timezone`)
      • requesting server version by command, not trusting initial handshake (option `forceVersionCheck`)
      • executing initial queries (option `initSql`)
      • setting default query timeout (option `queryTimeout`)

      When using callback connection, other commands can be programmed by application before connection is really established. In this particular case, the pre-commands might not be executed still.

      example :

        const mariadb = require('mariadb/callback');
        const conn = mariadb.createConnection({host: 'mydb.com', user:'myUser', password: 'myPwd'});
        conn.query("SELECT 1 as val", (err, rows) => { ...}
      

      conn is a connection object, but authentication isn't still done (it will only be done when 'connect' event is emited)

      Correction is to ensure pre-command are executed before any "quick commands"

      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.