Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

namedPlaceholders cannot be disabled at query level #2474

Open
wellwelwel opened this issue Mar 6, 2024 · 0 comments
Open

namedPlaceholders cannot be disabled at query level #2474

wellwelwel opened this issue Mar 6, 2024 · 0 comments

Comments

@wellwelwel
Copy link
Collaborator

wellwelwel commented Mar 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant