-
-
Notifications
You must be signed in to change notification settings - Fork 649
Open
Labels
Description
- As reported in chore: improve coverage and good practices for tests #2472
When setting namedPlaceholders
globally (connection level) to true
, it's not possible to disable it at the query level.
To reproduce, just uncomment this test:
node-mysql2/test/esm/integration/named-placeholders.test.mjs
Lines 18 to 29 in 41d21eb
// test(() => { | |
// const c = createConnection({ namedPlaceholders: true }); | |
// c.query({ sql: query, namedPlaceholders: false }, values, (err) => { | |
// c.end(); | |
// assert( | |
// err || err?.sqlMessage.match(/right syntax to use near ':named'/), | |
// 'Enabled in connection config, disabled in query command', | |
// ); | |
// }); | |
// }); |
The opposite will work fine:
node-mysql2/test/esm/integration/named-placeholders.test.mjs
Lines 31 to 44 in 41d21eb
test(() => { | |
const c = createConnection({ namedPlaceholders: false }); | |
c.query({ sql: query, namedPlaceholders: true }, values, (err, rows) => { | |
c.end(); | |
assert.ifError(err); | |
assert.equal( | |
rows[0].result, | |
1, | |
'Disabled in connection config, enabled in query command', | |
); | |
}); | |
}); |