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
Merged

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

merged 9 commits into from Jun 1, 2023

Conversation

sudarshan12s
Copy link

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • If a documentation update is necessary, have you opened a PR to the documentation repository?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description Of Change

For Sequelize Raw queries such as below , the input bind value parameter, { one: 1, two: 2 } is converted to array [1,2] which is not required. Hence fixed code to avoid the same.

const result = await this.sequelize.query(select $one${typeCast} as foo, $two${typeCast} as bar${Support.addDualInSelect()}, { raw: true, bind: { one: 1, two: 2 }, logging(s) { logSql = s; } });

Todos

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this?

@sudarshan12s
Copy link
Author

sudarshan12s commented May 26, 2023

Can you add a test for this?

Can you add a test for this?

Yes. changed the existing test case. The issue happened when bind values were sent as array and they are treated like replacements (?) . I modified the existing test case to change the order of bind names like ' select :one as foo, :one as bar, :two as baz FROM DUAL' instead of 'select :one as foo, :two as bar, :one as baz FROM DUAL'. The test fails with Oracle dialect with error 'ORA-01008: not all variables bound' . With the fix to retain the bind values as it is { one: 1, two: 2 } , the test case passed.

@WikiRik WikiRik merged commit fd38e79 into sequelize:v6 Jun 1, 2023
49 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

🎉 This PR is included in version 6.32.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants