Skip to content

Commit

Permalink
HHH-1706 - Named parameters ignored when single apostrophe encountere…
Browse files Browse the repository at this point in the history
…d within an SQL comment

(cherry picked from commit 2b56379)
  • Loading branch information
sebersole committed Nov 9, 2015
1 parent f6de8f8 commit 4bfb349
Showing 1 changed file with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,28 @@ public static void parse(String sqlString, Recognizer recognizer) throws QueryEx
final char c = sqlString.charAt( indx );
final boolean lastCharacter = indx == stringLength-1;

if ( inLineComment ) {
if ( inDelimitedComment ) {
recognizer.other( c );
if ( !lastCharacter && '*' == c && '/' == sqlString.charAt( indx+1 ) ) {
inDelimitedComment = false;
recognizer.other( sqlString.charAt( indx+1 ) );
indx++;
}
}
else if ( !lastCharacter && '/' == c && '*' == sqlString.charAt( indx+1 ) ) {
inDelimitedComment = true;
recognizer.other( c );
recognizer.other( sqlString.charAt( indx+1 ) );
indx++;
}
else if ( inLineComment ) {
recognizer.other( c );
// see if the character ends the line
if ( '\n' == c ) {
inLineComment = false;
recognizer.other( c );
}
else if ( '\r' == c ) {
inLineComment = false;
recognizer.other( c );
if ( !lastCharacter && '\n' == sqlString.charAt( indx+1 ) ) {
recognizer.other( sqlString.charAt( indx+1 ) );
indx++;
Expand All @@ -117,20 +130,6 @@ else if ( '-' == c ) {
indx++;
}
}
else if ( inDelimitedComment ) {
recognizer.other( c );
if ( !lastCharacter && '*' == c && '/' == sqlString.charAt( indx+1 ) ) {
inDelimitedComment = true;
recognizer.other( sqlString.charAt( indx+1 ) );
indx++;
}
}
else if ( !lastCharacter && '/' == c && '*' == sqlString.charAt( indx+1 ) ) {
inDelimitedComment = true;
recognizer.other( c );
recognizer.other( sqlString.charAt( indx+1 ) );
indx++;
}
else if ( inDoubleQuotes ) {
if ( '\"' == c ) {
inDoubleQuotes = false;
Expand Down

0 comments on commit 4bfb349

Please sign in to comment.