HHH-7973 - Fix String literals in an HQL query can get mangled
This commit is contained in:
parent
c9631a9ae2
commit
599df2405b
|
@ -89,6 +89,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;
|
||||
|
@ -130,6 +142,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