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

Spec Deviation in sql:ParameterizedQuery and sql:ParameterizedCallQuery #2056

Open
niveathika opened this issue Oct 16, 2021 · 1 comment · Fixed by ballerina-platform/module-ballerina-sql#411
Assignees
Labels
module/sql Points/1.5 Priority/High Team/DIU Data, IO, and Util packages related issues Type/Bug Verson/SwanLakeDump All issues planned for Swan Lake GA release

Comments

@niveathika
Copy link
Contributor

niveathika commented Oct 16, 2021

Description:

As per the spec, RawTemplate should support Backtick(`) within the Query. This can be supported by introducing the following interpolation, ${"`"}.

Currently sql:ParameterizedQuery and sql:ParameterizedCallQuery does not support ${"`"} intropolation.

@niveathika
Copy link
Contributor Author

Reopening as the fix is incomplete, this will fail for following scenario,

Payment[] paymentArr = [{date: "2022-02-03", amount: 0.0, employee_id: 0, reason: "`"}];
    sql:ParameterizedQuery[] insertQuaries = from var payment in paymentArr
        select `INSERT INTO Payment(date, amount, employee_id, reason) VALUES(${payment.date}, ${payment.amount}, ${payment.employee_id}, ${payment.reason})`;

With the fix the ``` used in the user insertion data is not escaped and leads to query corruption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/sql Points/1.5 Priority/High Team/DIU Data, IO, and Util packages related issues Type/Bug Verson/SwanLakeDump All issues planned for Swan Lake GA release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant