fix rendering of in (...) lists

they are not function calls
This commit is contained in:
Gavin 2023-04-30 18:12:12 +02:00 committed by Christian Beikov
parent 8e9df4344e
commit 167a14bcc7
10 changed files with 35 additions and 35 deletions

View File

@ -210,7 +210,7 @@ public class DerbyLegacySqlAstTranslator<T extends JdbcOperation> extends Abstra
if ( inListPredicate.isNegated() ) {
appendSql( " not" );
}
appendSql( " in(" );
appendSql( " in (" );
renderCommaSeparated( listExpressions );
appendSql( CLOSE_PARENTHESIS );
}

View File

@ -238,7 +238,7 @@ public class FirebirdSqlAstTranslator<T extends JdbcOperation> extends AbstractS
if ( inListPredicate.isNegated() ) {
appendSql( " not" );
}
appendSql( " in(" );
appendSql( " in (" );
renderCommaSeparated( listExpressions );
appendSql( CLOSE_PARENTHESIS );
}

View File

@ -6770,7 +6770,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
if ( inListPredicate.isNegated() ) {
appendSql( " not" );
}
appendSql( " in(" );
appendSql( " in (" );
String separator = NO_SEPARATOR;
for ( Expression expression : listExpressions ) {
appendSql( separator );
@ -6802,7 +6802,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
if ( inListPredicate.isNegated() ) {
appendSql( " not" );
}
appendSql( " in(" );
appendSql( " in (" );
String separator = NO_SEPARATOR;
int bindValueCount = listExpressions.size();
@ -6868,7 +6868,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
if ( inListPredicate.isNegated() ) {
appendSql( " not" );
}
appendSql( " in(" );
appendSql( " in (" );
separator = NO_SEPARATOR;
itemNumber = 0;
while ( iterator.hasNext() && itemNumber < inExprLimit ) {
@ -7421,7 +7421,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
if ( operator == ComparisonOperator.NOT_EQUAL ) {
appendSql( " not" );
}
appendSql( " in(" );
appendSql( " in (" );
renderExpressionsAsSubquery( rhsTuple.getExpressions() );
appendSql( CLOSE_PARENTHESIS );
}

View File

@ -100,8 +100,8 @@ public class BatchAndClassIdTest {
Assertions.assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "?" );
}
else {
Assertions.assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
}
statementInspector.clear();

View File

@ -100,8 +100,8 @@ public class BatchAndEmbeddedIdId2Test {
Assertions.assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "?" );
}
else {
Assertions.assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
}
statementInspector.clear();

View File

@ -108,8 +108,8 @@ public class BatchAndEmbeddedIdIdAndLazyCollectionTest {
Assertions.assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "?" );
}
else {
Assertions.assertThat( statementInspector.getSqlQueries().get( 0 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 0 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
Assertions.assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
}
}
);

View File

@ -98,8 +98,8 @@ public class BatchAndEmbeddedIdIdTest {
assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "?" );
}
else {
assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "in(?,?,?,?,?)" );
assertThat( statementInspector.getSqlQueries().get( 1 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
assertThat( statementInspector.getSqlQueries().get( 2 ) ).containsOnlyOnce( "in (?,?,?,?,?)" );
}
statementInspector.clear();

View File

@ -75,7 +75,7 @@ public class InClauseParameterPaddingCriteriaTest {
assertEquals( 1, ids.size() );
} );
assertTrue( statementInspector.getSqlQueries().get( 0 ).endsWith( "in(?,?,?,?,?,?,?,?)" ) );
assertTrue( statementInspector.getSqlQueries().get( 0 ).endsWith( "in (?,?,?,?,?,?,?,?)" ) );
}
@Test
@ -102,7 +102,7 @@ public class InClauseParameterPaddingCriteriaTest {
assertEquals( 1, ids.size() );
} );
assertTrue( statementInspector.getSqlQueries().get( 0 ).endsWith( "in(d1_0.id,d1_0.id,d1_0.id)" ) );
assertTrue( statementInspector.getSqlQueries().get( 0 ).endsWith( "in (d1_0.id,d1_0.id,d1_0.id)" ) );
}
@Entity(name = "Document")

View File

@ -54,16 +54,16 @@ public class InClauseParameterPaddingTest {
@Test
public void testInClauseParameterPadding(EntityManagerFactoryScope scope) {
validateInClauseParameterPadding( scope, "in(?)", 1 );
validateInClauseParameterPadding( scope, "in(?,?)", 1, 2 );
validateInClauseParameterPadding( scope, "in(?,?,?,?)", 1, 2, 3 );
validateInClauseParameterPadding( scope, "in(?,?,?,?)", 1, 2, 3, 4 );
validateInClauseParameterPadding( scope, "in(?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5 );
validateInClauseParameterPadding( scope, "in(?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6 );
validateInClauseParameterPadding( scope, "in(?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7 );
validateInClauseParameterPadding( scope, "in(?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7, 8 );
validateInClauseParameterPadding( scope, "in(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7, 8, 9 );
validateInClauseParameterPadding( scope, "in(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 );
validateInClauseParameterPadding( scope, "in (?)", 1 );
validateInClauseParameterPadding( scope, "in (?,?)", 1, 2 );
validateInClauseParameterPadding( scope, "in (?,?,?,?)", 1, 2, 3 );
validateInClauseParameterPadding( scope, "in (?,?,?,?)", 1, 2, 3, 4 );
validateInClauseParameterPadding( scope, "in (?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5 );
validateInClauseParameterPadding( scope, "in (?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6 );
validateInClauseParameterPadding( scope, "in (?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7 );
validateInClauseParameterPadding( scope, "in (?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7, 8 );
validateInClauseParameterPadding( scope, "in (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7, 8, 9 );
validateInClauseParameterPadding( scope, "in (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 );
}
private void validateInClauseParameterPadding(

View File

@ -83,7 +83,7 @@ public class MaxInExpressionParameterPaddingTest {
);
StringBuilder expectedInClause = new StringBuilder();
expectedInClause.append( "in(?" );
expectedInClause.append( "in (?" );
for ( int i = 1; i < MAX_COUNT; i++ ) {
expectedInClause.append( ",?" );
}
@ -109,7 +109,7 @@ public class MaxInExpressionParameterPaddingTest {
);
StringBuilder expectedInClause = new StringBuilder();
expectedInClause.append( "in(?" );
expectedInClause.append( "in (?" );
for ( int i = 1; i < MAX_COUNT; i++ ) {
expectedInClause.append( ",?" );
}
@ -134,12 +134,12 @@ public class MaxInExpressionParameterPaddingTest {
);
StringBuilder expectedInClause = new StringBuilder();
expectedInClause.append( "in(?" );
expectedInClause.append( "in (?" );
for ( int i = 1; i < MAX_COUNT; i++ ) {
expectedInClause.append( ",?" );
}
expectedInClause.append( ")" );
expectedInClause.append( " or p1_0.id in(?)" );
expectedInClause.append( " or p1_0.id in (?)" );
assertTrue( statementInspector.getSqlQueries().get( 0 ).endsWith( expectedInClause.toString() ) );
}
@ -160,12 +160,12 @@ public class MaxInExpressionParameterPaddingTest {
);
StringBuilder expectedInClause = new StringBuilder();
expectedInClause.append( "in(?" );
expectedInClause.append( "in (?" );
for ( int i = 1; i < MAX_COUNT; i++ ) {
expectedInClause.append( ",?" );
}
expectedInClause.append( ")" );
expectedInClause.append( " or p1_0.id in(?,?,?,?)" );
expectedInClause.append( " or p1_0.id in (?,?,?,?)" );
assertTrue( statementInspector.getSqlQueries().get( 0 ).endsWith( expectedInClause.toString() ) );
}
@ -186,17 +186,17 @@ public class MaxInExpressionParameterPaddingTest {
);
StringBuilder expectedInClause = new StringBuilder();
expectedInClause.append( "in(?" );
expectedInClause.append( "in (?" );
for ( int i = 1; i < MAX_COUNT; i++ ) {
expectedInClause.append( ",?" );
}
expectedInClause.append( ")" );
expectedInClause.append( " or p1_0.id in(?");
expectedInClause.append( " or p1_0.id in (?");
for ( int i = 1; i < MAX_COUNT; i++ ) {
expectedInClause.append( ",?" );
}
expectedInClause.append( ")" );
expectedInClause.append( " or p1_0.id in(?,?,?,?)" );
expectedInClause.append( " or p1_0.id in (?,?,?,?)" );
assertTrue( statementInspector.getSqlQueries().get( 0 ).endsWith( expectedInClause.toString() ) );