Raw Queries with multiple Bind Parameters and in wrong order not working properly - (tested on Oracle) #17322
Labels
pending-approval
Bug reports that have not been verified yet, or feature requests that have not been accepted yet
type: bug
Issue Creation Checklist
Bug Description
I noticed that Sequelize transforms the parameters into an array and doesn't care about the order they are being used within the query which can result in not having any results when doing a SELECT.
It was not tested in other circumstances like INSERT or UPDATE.
Reproducible Example
It is as simple as doing a raw query in any Oracle table using more than one condition and passing them in the wrong order like:
What do you expect to happen?
Insite the oracle/query.js when call the execute, is supposed to send:
What is actually happening?
Because the variable this.bindParameters is being populated with a simple forEach, it is getting the wrong result or nothing.
I suggest fixing it by adding the matcher before pushing the parameter to the parameter list as long as we need them, also if we were using one parameter multiple times, it would cover it.
Environment
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: