Skip to content

Commit

Permalink
fix(oracle): For Raw queries avoid converting the input parameters pa…
Browse files Browse the repository at this point in the history
…ssed (#16067)
  • Loading branch information
sudarshan12s committed Jun 1, 2023
1 parent eb71077 commit fd38e79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit fd38e79

Please sign in to comment.