HHH-18225 Fix for Informix syntax error in DISTINCT clause before SKIP clause
This commit is contained in:
parent
224e8ca57a
commit
b687120bad
|
@ -10,11 +10,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.query.sqm.ComparisonOperator;
|
import org.hibernate.query.sqm.ComparisonOperator;
|
||||||
|
import org.hibernate.sql.ast.Clause;
|
||||||
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
|
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
|
||||||
import org.hibernate.sql.ast.spi.AbstractSqlAstTranslator;
|
import org.hibernate.sql.ast.spi.AbstractSqlAstTranslator;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.ast.tree.Statement;
|
import org.hibernate.sql.ast.tree.Statement;
|
||||||
import org.hibernate.sql.ast.tree.cte.CteStatement;
|
|
||||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||||
import org.hibernate.sql.ast.tree.expression.Literal;
|
import org.hibernate.sql.ast.tree.expression.Literal;
|
||||||
import org.hibernate.sql.ast.tree.expression.SqlTuple;
|
import org.hibernate.sql.ast.tree.expression.SqlTuple;
|
||||||
|
@ -35,6 +35,21 @@ public class InformixSqlAstTranslator<T extends JdbcOperation> extends AbstractS
|
||||||
super( sessionFactory, statement );
|
super( sessionFactory, statement );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitSelectClause(SelectClause selectClause) {
|
||||||
|
getClauseStack().push( Clause.SELECT );
|
||||||
|
|
||||||
|
try {
|
||||||
|
appendSql( "select " );
|
||||||
|
visitSqlSelections( selectClause );
|
||||||
|
renderVirtualSelections( selectClause );
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
getClauseStack().pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void visitSqlSelections(SelectClause selectClause) {
|
protected void visitSqlSelections(SelectClause selectClause) {
|
||||||
if ( supportsSkipFirstClause() ) {
|
if ( supportsSkipFirstClause() ) {
|
||||||
|
@ -43,6 +58,9 @@ public class InformixSqlAstTranslator<T extends JdbcOperation> extends AbstractS
|
||||||
else {
|
else {
|
||||||
renderFirstClause( (QuerySpec) getQueryPartStack().getCurrent() );
|
renderFirstClause( (QuerySpec) getQueryPartStack().getCurrent() );
|
||||||
}
|
}
|
||||||
|
if ( selectClause.isDistinct() ) {
|
||||||
|
appendSql( "distinct " );
|
||||||
|
}
|
||||||
super.visitSqlSelections( selectClause );
|
super.visitSqlSelections( selectClause );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue