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

fix(oracle): For Raw queries avoid converting the input parameters passed #16067

Merged
merged 9 commits into from Jun 1, 2023
2 changes: 2 additions & 0 deletions src/dialects/oracle/query.js
Expand Up @@ -121,6 +121,8 @@ export class OracleQuery extends AbstractQuery {
bindDef.push(...Object.values(this.options.inbindAttributes));
bindDef.push(...outParameters);
this.bindParameters = parameters;
} else if (this.isRawQuery()) {
this.bindParameters = parameters;
} else {
Object.values(parameters).forEach(value => {
bindParameters.push(value);
Expand Down
4 changes: 2 additions & 2 deletions test/integration/sequelize/query.test.js
Expand Up @@ -713,8 +713,8 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
it('binds named parameters with the passed object using the same key twice', async function() {
const typeCast = dialect === 'postgres' ? '::int' : '';
let logSql;
const result = await this.sequelize.query(`select $one${typeCast} as foo, $two${typeCast} as bar, $one${typeCast} as baz${Support.addDualInSelect()}`, { raw: true, bind: { one: 1, two: 2 }, logging(s) { logSql = s; } });
const expected = dialect !== 'oracle' ? [{ foo: 1, bar: 2, baz: 1 }] : [{ FOO: 1, BAR: 2, BAZ: 1 }];
const result = await this.sequelize.query(`select $one${typeCast} as foo, $one${typeCast} as bar, $two${typeCast} as baz${Support.addDualInSelect()}`, { raw: true, bind: { one: 1, two: 2 }, logging(s) { logSql = s; } });
const expected = dialect !== 'oracle' ? [{ foo: 1, bar: 1, baz: 2 }] : [{ FOO: 1, BAR: 1, BAZ: 2 }];
expect(result[0]).to.deep.equal(expected);
if (dialect === 'postgres') {
expect(logSql).to.include('$1');
Expand Down