HHH-3510 : HQL SQLFunction replacement not occuring when HQL text has no parenthesis (rollback)
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@15243 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
d4f929aab3
commit
bd3170db4f
|
@ -27,7 +27,6 @@ package org.hibernate.hql.ast.tree;
|
|||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
import org.hibernate.hql.antlr.SqlTokenTypes;
|
||||
import org.hibernate.hql.ast.util.ColumnHelper;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
|
@ -38,7 +37,6 @@ import org.hibernate.type.Type;
|
|||
import org.hibernate.util.StringHelper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Represents an identifier all by itself, which may be a function name,
|
||||
|
@ -129,14 +127,6 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
// resolve this...
|
||||
return;
|
||||
}
|
||||
else if ( result == UNKNOWN ) {
|
||||
final SQLFunction sqlFunction = getSessionFactoryHelper().findSQLFunction( getText() );
|
||||
if ( sqlFunction != null ) {
|
||||
setText( sqlFunction.render( Collections.EMPTY_LIST, getSessionFactoryHelper().getFactory() ) );
|
||||
setDataType( sqlFunction.getReturnType( null, getSessionFactoryHelper().getFactory() ) );
|
||||
setResolved();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we are still not resolved, we might represent a constant.
|
||||
|
@ -303,18 +293,18 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
}
|
||||
|
||||
public void setScalarColumnText(int i) throws SemanticException {
|
||||
if ( nakedPropertyRef ) {
|
||||
if (nakedPropertyRef) {
|
||||
// do *not* over-write the column text, as that has already been
|
||||
// "rendered" during resolve
|
||||
ColumnHelper.generateSingleScalarColumn( this, i );
|
||||
ColumnHelper.generateSingleScalarColumn(this, i);
|
||||
}
|
||||
else {
|
||||
FromElement fe = getFromElement();
|
||||
if ( fe != null ) {
|
||||
setText( fe.renderScalarIdentifierSelect( i ) );
|
||||
if (fe != null) {
|
||||
setText(fe.renderScalarIdentifierSelect(i));
|
||||
}
|
||||
else {
|
||||
ColumnHelper.generateSingleScalarColumn( this, i );
|
||||
ColumnHelper.generateSingleScalarColumn(this, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,19 +312,19 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
public String getDisplayText() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
if ( getType() == SqlTokenTypes.ALIAS_REF ) {
|
||||
buf.append( "{alias=" ).append( getOriginalText() );
|
||||
if ( getFromElement() == null ) {
|
||||
buf.append( ", no from element" );
|
||||
if (getType() == SqlTokenTypes.ALIAS_REF) {
|
||||
buf.append("{alias=").append(getOriginalText());
|
||||
if (getFromElement() == null) {
|
||||
buf.append(", no from element");
|
||||
}
|
||||
else {
|
||||
buf.append( ", className=" ).append( getFromElement().getClassName() );
|
||||
buf.append( ", tableAlias=" ).append( getFromElement().getTableAlias() );
|
||||
buf.append(", className=").append(getFromElement().getClassName());
|
||||
buf.append(", tableAlias=").append(getFromElement().getTableAlias());
|
||||
}
|
||||
buf.append( "}" );
|
||||
buf.append("}");
|
||||
}
|
||||
else {
|
||||
buf.append( "{originalText=" ).append( getOriginalText() ).append( "}" );
|
||||
buf.append("{originalText=" + getOriginalText()).append("}");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue