Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
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"