HHH-14251 Fix issue for Dialects not supporting row value constructor Syntax
This commit is contained in:
parent
9376650097
commit
e7bcc03ede
|
@ -111,7 +111,7 @@ public class BinaryLogicOperatorNode extends AbstractSelectExpression implements
|
|||
// mutation depends on the types of nodes involved...
|
||||
int comparisonType = getType();
|
||||
String comparisonText = getText();
|
||||
|
||||
if ( !isInsideSetClause() ) {
|
||||
switch ( comparisonType ) {
|
||||
case HqlSqlTokenTypes.EQ:
|
||||
setType( HqlSqlTokenTypes.AND );
|
||||
|
@ -126,6 +126,7 @@ public class BinaryLogicOperatorNode extends AbstractSelectExpression implements
|
|||
default:
|
||||
throw new QuerySyntaxException( comparisonText + " operator not supported on composite types." );
|
||||
}
|
||||
}
|
||||
|
||||
String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(), valueElements );
|
||||
String[] rhsElementTexts = extractMutationTexts( getRightHandOperand(), valueElements );
|
||||
|
@ -153,8 +154,10 @@ public class BinaryLogicOperatorNode extends AbstractSelectExpression implements
|
|||
}
|
||||
|
||||
protected void translate(
|
||||
int valueElements, int comparisonType,
|
||||
String comparisonText, String[] lhsElementTexts,
|
||||
int valueElements,
|
||||
int comparisonType,
|
||||
String comparisonText,
|
||||
String[] lhsElementTexts,
|
||||
String[] rhsElementTexts,
|
||||
ParameterSpecification lhsEmbeddedCompositeParameterSpecification,
|
||||
ParameterSpecification rhsEmbeddedCompositeParameterSpecification,
|
||||
|
@ -164,14 +167,21 @@ public class BinaryLogicOperatorNode extends AbstractSelectExpression implements
|
|||
|
||||
for ( int i = valueElements - 1; i > 0; i-- ) {
|
||||
if ( i == 1 ) {
|
||||
AST op1 = getASTFactory().create( comparisonType, comparisonText );
|
||||
final AST op1;
|
||||
if ( isInsideSetClause() ) {
|
||||
op1 = container;
|
||||
}
|
||||
else {
|
||||
op1 = getASTFactory().create( comparisonType, comparisonText );
|
||||
}
|
||||
|
||||
SqlFragment lhs1 = (SqlFragment) getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, lhsElementTexts[0] );
|
||||
SqlFragment rhs1 = (SqlFragment) getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, rhsElementTexts[0] );
|
||||
copyReferencedTables( leftHandOperand, lhs1 );
|
||||
copyReferencedTables( rightHandOperand, rhs1 );
|
||||
op1.setFirstChild( lhs1 );
|
||||
lhs1.setNextSibling( rhs1 );
|
||||
container.setFirstChild( op1 );
|
||||
|
||||
AST op2 = getASTFactory().create( comparisonType, comparisonText );
|
||||
SqlFragment lhs2 = (SqlFragment) getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, lhsElementTexts[1] );
|
||||
SqlFragment rhs2 = (SqlFragment) getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, rhsElementTexts[1] );
|
||||
|
@ -181,6 +191,10 @@ public class BinaryLogicOperatorNode extends AbstractSelectExpression implements
|
|||
lhs2.setNextSibling( rhs2 );
|
||||
op1.setNextSibling( op2 );
|
||||
|
||||
if ( !isInsideSetClause() ) {
|
||||
container.setFirstChild( op1 );
|
||||
}
|
||||
|
||||
// "pass along" our initial embedded parameter node(s) to the first generated
|
||||
// sql fragment so that it can be handled later for parameter binding...
|
||||
if ( lhsEmbeddedCompositeParameterSpecification != null ) {
|
||||
|
@ -206,6 +220,10 @@ public class BinaryLogicOperatorNode extends AbstractSelectExpression implements
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isInsideSetClause() {
|
||||
return getWalker().getCurrentClauseType() == HqlSqlTokenTypes.SET;
|
||||
}
|
||||
|
||||
private static void copyReferencedTables(Node from, SqlFragment to) {
|
||||
if (from instanceof TableReferenceNode) {
|
||||
TableReferenceNode tableReferenceNode = (TableReferenceNode) from;
|
||||
|
|
Loading…
Reference in New Issue