HHH-1706 - Named parameters ignored when single apostrophe encountered within an SQL comment

This commit is contained in:
Steve Ebersole 2015-11-09 15:19:55 -06:00
parent e4d102c5b1
commit 2b563794c7
1 changed files with 16 additions and 17 deletions

View File

@ -94,15 +94,28 @@ public class ParameterParser {
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++;
@ -117,20 +130,6 @@ public class ParameterParser {
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;