Skip to content

Commit

Permalink
[#7706] ArrayIndexOutOfBoundsException when using double quotes in pl…
Browse files Browse the repository at this point in the history
…ain SQL as string delimiters
  • Loading branch information
lukaseder committed Aug 8, 2018
1 parent dc363aa commit 04252a5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jOOQ/src/main/java/org/jooq/impl/Tools.java
Expand Up @@ -2042,16 +2042,20 @@ else if (peekAny(sqlChars, i, quotes[QUOTE_START_DELIMITER])) {
render.sql(sqlChars[i++]);

// Consume the whole identifier
identifierLoop:
for (;;) {

// Consume an escaped quote
if (peek(sqlChars, i, quotes[QUOTE_END_DELIMITER_ESCAPED][delimiter]))
if (peek(sqlChars, i, quotes[QUOTE_END_DELIMITER_ESCAPED][delimiter])) {
for (int d = 0; d < quotes[QUOTE_END_DELIMITER_ESCAPED][delimiter].length; d++)
render.sql(sqlChars[i++]);

continue identifierLoop;
}

// Break on the terminal identifier delimiter
else if (peek(sqlChars, i, quotes[QUOTE_END_DELIMITER][delimiter]))
break;
break identifierLoop;

// Consume identifier content
render.sql(sqlChars[i++]);
Expand Down

0 comments on commit 04252a5

Please sign in to comment.