HHH-7973 - Fix String literals in an HQL query can get mangled
This commit is contained in:
parent
9c75e79bc9
commit
57b32543ed
|
@ -90,6 +90,18 @@ public final class QuerySplitter {
|
|||
templateQuery.append( token );
|
||||
continue;
|
||||
}
|
||||
else if ( isTokenStartWithAQuoteCharacter( token ) ) {
|
||||
if ( !isTokenEndWithAQuoteCharacter( token ) ) {
|
||||
inQuote = true;
|
||||
}
|
||||
templateQuery.append( token );
|
||||
continue;
|
||||
}
|
||||
else if ( isTokenEndWithAQuoteCharacter( token ) ) {
|
||||
inQuote = false;
|
||||
templateQuery.append( token );
|
||||
continue;
|
||||
}
|
||||
else if ( inQuote ) {
|
||||
templateQuery.append( token );
|
||||
continue;
|
||||
|
@ -131,6 +143,14 @@ public final class QuerySplitter {
|
|||
return "'".equals( token ) || "\"".equals( token );
|
||||
}
|
||||
|
||||
private static boolean isTokenStartWithAQuoteCharacter(String token) {
|
||||
return token.startsWith( "'" ) || token.startsWith( "\"" );
|
||||
}
|
||||
|
||||
private static boolean isTokenEndWithAQuoteCharacter(String token) {
|
||||
return token.endsWith( "'" ) || token.endsWith( "\"" );
|
||||
}
|
||||
|
||||
private static String nextNonWhite(String[] tokens, int start) {
|
||||
for ( int i = start + 1; i < tokens.length; i++ ) {
|
||||
if ( !ParserHelper.isWhitespace( tokens[i] ) ) {
|
||||
|
|
Loading…
Reference in New Issue