Users/hattorihenzo/support procedure call without curly braces - #3016
Conversation
…o users/hattorihenzo/support-procedure-call-without-curly-braces
…o users/hattorihenzo/support-procedure-call-without-curly-braces
|
|
Hattori Henzo (@HattoriHenzo) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
Muskan Gupta (@muskan124947) Thanks for your feedback, I will take a look on it. |
|
Muskan Gupta (@muskan124947) I have to narrow the control of the SQL query syntax just only for |
|
Hattori Henzo (@HattoriHenzo) 1. Keeping the check out of 2. The heuristic still has false positives, even scoped. Java |
Description
This pull request enhances the parsing and validation of SQL call syntax in the JDBC driver, ensuring correct handling of braces in stored procedure calls. It updates the regular expressions and logic to support both braced and unbraced syntax, adds validation for matching braces, and introduces comprehensive tests to verify correct and incorrect usage.
Allowed syntax:
{call procedure(x,y)}orcall procedure(x,y)What's added
SQL_IDENTIFIER_PARTregex inSQLServerStatement.javato more accurately match SQL identifiers, including those outside parentheses and braces.JDBC_CALL_SYNTAXregex to support both optional opening and closing braces in procedure call syntax.translatemethod to ensure SQL statements have matching braces before applying regex parsing, throwing aSQLServerExceptionif mismatched.hasMatchingBraceshelper method to encapsulate brace validation logic.Testing
CallableStatementTest.javato verify that procedure calls with and without braces work correctly, and that malformed calls with mismatched braces throw exceptions as expected.CallableStatementTest.javafor better readability.