File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
hibernate-community-dialects/src/main/java/org/hibernate/community/dialect
hibernate-core/src/main/java/org/hibernate Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -251,4 +251,10 @@ public int rowIdSqlType() {
251251 public String getRowIdColumnString (String rowId ) {
252252 return rowId ( rowId ) + " rowid not null generated always" ;
253253 }
254+
255+ @ Override
256+ public boolean supportsValuesList () {
257+ // DB2 z/OS has a VALUES statement, but that doesn't support multiple values
258+ return false ;
259+ }
254260}
Original file line number Diff line number Diff line change @@ -233,4 +233,10 @@ public int rowIdSqlType() {
233233 public String getRowIdColumnString (String rowId ) {
234234 return rowId ( rowId ) + " rowid not null generated always" ;
235235 }
236+
237+ @ Override
238+ public boolean supportsValuesList () {
239+ // DB2 z/OS has a VALUES statement, but that doesn't support multiple values
240+ return false ;
241+ }
236242}
Original file line number Diff line number Diff line change @@ -7705,12 +7705,21 @@ public void visitInListPredicate(InListPredicate inListPredicate) {
77057705 else if ( !supportsRowValueConstructorSyntaxInInList () ) {
77067706 // Some DBs like Oracle support tuples only for the IN subquery predicate
77077707 if ( supportsRowValueConstructorSyntaxInInSubQuery () && dialect .supportsValuesList () ) {
7708+ final int tupleSize = lhsTuple .getExpressionType ().getJdbcTypeCount ();
77087709 inListPredicate .getTestExpression ().accept ( this );
77097710 if ( inListPredicate .isNegated () ) {
77107711 appendSql ( " not" );
77117712 }
7712- appendSql ( " in (select * from (values " );
7713+ appendSql ( " in (select" );
77137714 char separator = ' ' ;
7715+ for ( int i = 0 ; i < tupleSize ; i ++ ) {
7716+ appendSql ( separator );
7717+ appendSql ( "v_.c" );
7718+ appendSql ( i );
7719+ separator = ',' ;
7720+ }
7721+ appendSql ( " from (values" );
7722+ separator = ' ' ;
77147723 for ( Expression expression : listExpressions ) {
77157724 appendSql ( separator );
77167725 appendSql ( OPEN_PARENTHESIS );
@@ -7719,6 +7728,15 @@ else if ( !supportsRowValueConstructorSyntaxInInList() ) {
77197728 separator = ',' ;
77207729 }
77217730 appendSql ( CLOSE_PARENTHESIS );
7731+ appendSql ( " v_" );
7732+ separator = '(' ;
7733+ for ( int i = 0 ; i < tupleSize ; i ++ ) {
7734+ appendSql ( separator );
7735+ appendSql ( "c" );
7736+ appendSql ( i );
7737+ separator = ',' ;
7738+ }
7739+ appendSql ( CLOSE_PARENTHESIS );
77227740 appendSql ( CLOSE_PARENTHESIS );
77237741 }
77247742 else if ( supportsRowValueConstructorSyntaxInInSubQuery () && dialect .supportsUnionAll () ) {
You can’t perform that action at this time.
0 commit comments