mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-20 01:55:02 +00:00
HHH-530 : problem with parameter-pulling when row value constructor morphed on dialects not supporting
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@15538 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
b4d814bbff
commit
3f20292fb5
@ -20,7 +20,6 @@
|
|||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.hql.ast.tree;
|
package org.hibernate.hql.ast.tree;
|
||||||
|
|
||||||
@ -28,6 +27,7 @@
|
|||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.hibernate.TypeMismatchException;
|
import org.hibernate.TypeMismatchException;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.param.ParameterSpecification;
|
||||||
import org.hibernate.util.StringHelper;
|
import org.hibernate.util.StringHelper;
|
||||||
import org.hibernate.hql.antlr.HqlSqlTokenTypes;
|
import org.hibernate.hql.antlr.HqlSqlTokenTypes;
|
||||||
import org.hibernate.engine.SessionFactoryImplementor;
|
import org.hibernate.engine.SessionFactoryImplementor;
|
||||||
@ -117,9 +117,18 @@ private void mutateRowValueConstructorSyntax(int valueElements) {
|
|||||||
String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(), valueElements );
|
String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(), valueElements );
|
||||||
String[] rhsElementTexts = extractMutationTexts( getRightHandOperand(), valueElements );
|
String[] rhsElementTexts = extractMutationTexts( getRightHandOperand(), valueElements );
|
||||||
|
|
||||||
|
ParameterSpecification lhsEmbeddedCompositeParameterSpecification =
|
||||||
|
getLeftHandOperand() == null || ( !ParameterNode.class.isInstance( getLeftHandOperand() ) )
|
||||||
|
? null
|
||||||
|
: ( ( ParameterNode ) getLeftHandOperand() ).getHqlParameterSpecification();
|
||||||
|
|
||||||
|
ParameterSpecification rhsEmbeddedCompositeParameterSpecification =
|
||||||
|
getRightHandOperand() == null || ( !ParameterNode.class.isInstance( getRightHandOperand() ) )
|
||||||
|
? null
|
||||||
|
: ( ( ParameterNode ) getRightHandOperand() ).getHqlParameterSpecification();
|
||||||
|
|
||||||
AST container = this;
|
AST container = this;
|
||||||
for ( int i = valueElements - 1; i > 0; i-- ) {
|
for ( int i = valueElements - 1; i > 0; i-- ) {
|
||||||
|
|
||||||
if ( i == 1 ) {
|
if ( i == 1 ) {
|
||||||
AST op1 = getASTFactory().create( comparisonType, comparisonText );
|
AST op1 = getASTFactory().create( comparisonType, comparisonText );
|
||||||
AST lhs1 = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, lhsElementTexts[0] );
|
AST lhs1 = getASTFactory().create( HqlSqlTokenTypes.SQL_TOKEN, lhsElementTexts[0] );
|
||||||
@ -133,6 +142,16 @@ private void mutateRowValueConstructorSyntax(int valueElements) {
|
|||||||
op2.setFirstChild( lhs2 );
|
op2.setFirstChild( lhs2 );
|
||||||
lhs2.setNextSibling( rhs2 );
|
lhs2.setNextSibling( rhs2 );
|
||||||
op1.setNextSibling( op2 );
|
op1.setNextSibling( op2 );
|
||||||
|
|
||||||
|
// "pass along" our initial embedded parameter node(s) to the first generated
|
||||||
|
// sql fragment so that it can be handled later for parameter binding...
|
||||||
|
SqlFragment fragment = ( SqlFragment ) lhs1;
|
||||||
|
if ( lhsEmbeddedCompositeParameterSpecification != null ) {
|
||||||
|
fragment.addEmbeddedParameter( lhsEmbeddedCompositeParameterSpecification );
|
||||||
|
}
|
||||||
|
if ( rhsEmbeddedCompositeParameterSpecification != null ) {
|
||||||
|
fragment.addEmbeddedParameter( rhsEmbeddedCompositeParameterSpecification );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AST op = getASTFactory().create( comparisonType, comparisonText );
|
AST op = getASTFactory().create( comparisonType, comparisonText );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user