Skip to content

namedPlaceholders cannot be disabled at query level #2474

@wellwelwel

Description

@wellwelwel

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:

// 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:

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',
);
});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions