HHH-15102 allow -- style comments in native SQL query
This commit is contained in:
parent
39f5946bd3
commit
1287d93a5b
|
@ -69,8 +69,16 @@ public class BasicFormatterImpl implements Formatter {
|
|||
|
||||
while ( tokens.hasMoreTokens() ) {
|
||||
token = tokens.nextToken();
|
||||
lcToken = token.toLowerCase(Locale.ROOT);
|
||||
|
||||
if ( "-".equals(token) && result.toString().endsWith("-") ) {
|
||||
do {
|
||||
result.append( token );
|
||||
token = tokens.nextToken();
|
||||
}
|
||||
while ( !"\n".equals( token ) && tokens.hasMoreTokens() );
|
||||
}
|
||||
|
||||
lcToken = token.toLowerCase(Locale.ROOT);
|
||||
switch (lcToken) {
|
||||
|
||||
case "'":
|
||||
|
|
|
@ -836,6 +836,12 @@ public class NativeSQLQueriesTest {
|
|||
);
|
||||
}
|
||||
|
||||
@Test @JiraKey( "HHH-15102" )
|
||||
@SkipForDialect(dialectClass = MySQLDialect.class, matchSubTypes = true)
|
||||
public void testCommentInSQLQuery(SessionFactoryScope scope) {
|
||||
scope.inTransaction( s -> s.createNativeQuery( "select sum(1) --count(*), effectively\nfrom ORGANIZATION" ).getSingleResult() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextTypeInSQLQuery(SessionFactoryScope scope) {
|
||||
String description = buildLongString( 15000, 'a' );
|
||||
|
|
Loading…
Reference in New Issue