Skip to content

Commit

Permalink
JDBC-632 Fix case sensitivity first letter in escape clause
Browse files Browse the repository at this point in the history
The commit in master contains more extensive tests
  • Loading branch information
mrotteveel committed Aug 11, 2020
1 parent f651911 commit ca6f796
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/documentation/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ The following has been changed or fixed since Jaybird 3.0.9:
implementation details that might change in future versions. \
This feature was backported from Jaybird 4.0.1.
- Fixed: Use of `isc_dpb_no_db_triggers` no longer logs a warning ([JDBC-628](http://tracker.firebirdsql.org/browse/JDBC-628))
- Fixed: First letter of JDBC escape was case-sensitive ([JDBC-632](http://tracker.firebirdsql.org/browse/JDBC-632)) \
This was a regression compared to 2.2.x.

### Known issues in Jaybird 3.0.10

Expand Down
7 changes: 7 additions & 0 deletions src/main/org/firebirdsql/jdbc/escape/FBEscapedParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,19 @@ protected ParserState nextState(char inputChar) throws FBSQLParseException {
switch (inputChar) {
case '?': // start of {?= call ...}
case 'c': // start of {call ...}
case 'C':
case 'd': // start of {d ...}
case 'D':
case 't': // start of {t ...} or {ts ...}
case 'T':
case 'e': // start of {escape ...}
case 'E':
case 'f': // start of {fn ...}
case 'F':
case 'o': // start of {oj ...}
case 'O':
case 'l': // start of {limit ...}
case 'L':
return NORMAL_STATE;
default:
throw new FBSQLParseException("Unexpected first character inside JDBC escape: " + inputChar);
Expand Down
10 changes: 10 additions & 0 deletions src/test/org/firebirdsql/jdbc/escape/TestFBEscapedParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ public void testCallEscape() throws Exception {
String parseResult = parser.parse(input);
assertEquals("Unexpected output for {call ..}", expectedOutput, parseResult);
}

@Test
public void testCallEscape_caseInsensitive() throws Exception {
final FBEscapedParser parser = new FBEscapedParser(EscapeParserMode.USE_BUILT_IN);
final String input = "{CALL FUNCTION(?,?)}";
final String expectedOutput = "EXECUTE PROCEDURE FUNCTION(?,?)";

String parseResult = parser.parse(input);
assertEquals("Unexpected output for {call ..}", expectedOutput, parseResult);
}

@Test
public void testQuestionmarkCallEscape() throws Exception {
Expand Down

0 comments on commit ca6f796

Please sign in to comment.