Skip to content

Commit

Permalink
Fixed sprocs with parentheses (#2467)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyc authored Jul 4, 2024
1 parent 285f4f6 commit 8f53c02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void setPreparedStatementHandle(int handle) {
* Regex for JDBC 'call' escape syntax
*/
private static final Pattern callEscapePattern = Pattern
.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call [^\\(\\)]+\\s*(\\(\\s*\\?\\s*(,\\s*\\?\\s*)*\\))?\\s*}");
.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call [^\\(\\)]+\\s*((\\(\\s*\\?\\s*(,\\s*\\?\\s*)*\\))?|\\(\\))\\s*}");

/**
* Regex for 'exec' escape syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,17 @@ public void testZeroParamSproc() throws SQLException {
cs.execute();
assertEquals(1, cs.getInt(1));
}

// Test zero parameter sproc with return value with parentheses
call = "{? = CALL " + zeroParamSproc + "()}";

try (CallableStatement cs = connection.prepareCall(call)) {
cs.registerOutParameter(1, Types.INTEGER);
cs.execute();
// Calling zero parameter sproc with return value with parentheses
// should return a value that's not zero
assertEquals(1, cs.getInt(1));
}
}

@Test
Expand Down

0 comments on commit 8f53c02

Please sign in to comment.