HHH-17776 - Fix whitespace padding issues for literals in select expressions on Derby and HSQLDB
Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
parent
ee76f005aa
commit
955b587eb7
|
@ -232,8 +232,13 @@ public class DerbySqlAstTranslator<T extends JdbcOperation> extends AbstractSqlA
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderSelectExpression(Expression expression) {
|
protected void renderSelectExpression(Expression expression) {
|
||||||
|
if ( isInSubquery() && expression instanceof Literal ) {
|
||||||
|
renderCasted( expression );
|
||||||
|
}
|
||||||
|
else {
|
||||||
renderSelectExpressionWithCastedOrInlinedPlainParameters( expression );
|
renderSelectExpressionWithCastedOrInlinedPlainParameters( expression );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderSelectTupleComparison(
|
protected void renderSelectTupleComparison(
|
||||||
|
|
|
@ -258,8 +258,13 @@ public class HSQLSqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAs
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderSelectExpression(Expression expression) {
|
protected void renderSelectExpression(Expression expression) {
|
||||||
|
if ( isInSubquery() && expression instanceof Literal ) {
|
||||||
|
renderCasted( expression );
|
||||||
|
}
|
||||||
|
else {
|
||||||
renderSelectExpressionWithCastedOrInlinedPlainParameters( expression );
|
renderSelectExpressionWithCastedOrInlinedPlainParameters( expression );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderSelectTupleComparison(
|
protected void renderSelectTupleComparison(
|
||||||
|
|
|
@ -2442,7 +2442,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
.get( 1 ) == getCurrentQueryPart();
|
.get( 1 ) == getCurrentQueryPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInSubquery() {
|
protected boolean isInSubquery() {
|
||||||
return statementStack.depth() > 1 && statementStack.getCurrent() instanceof SelectStatement
|
return statementStack.depth() > 1 && statementStack.getCurrent() instanceof SelectStatement
|
||||||
&& !( (SelectStatement) statementStack.getCurrent() ).getQueryPart().isRoot();
|
&& !( (SelectStatement) statementStack.getCurrent() ).getQueryPart().isRoot();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,8 @@ public class SubqueryTests {
|
||||||
JpaDerivedRoot<Tuple> mainQueryRoot = mainQuery.from( unionAllSubQuery );
|
JpaDerivedRoot<Tuple> mainQueryRoot = mainQuery.from( unionAllSubQuery );
|
||||||
|
|
||||||
mainQuery.multiselect(
|
mainQuery.multiselect(
|
||||||
builder.trim(mainQueryRoot.get("name")).alias("name"),
|
mainQueryRoot.get("name").alias("name"),
|
||||||
builder.trim(mainQueryRoot.get("surName")).alias("surName")
|
mainQueryRoot.get("surName").alias("surName")
|
||||||
);
|
);
|
||||||
mainQuery.orderBy( builder.asc(mainQueryRoot.get("name")) );
|
mainQuery.orderBy( builder.asc(mainQueryRoot.get("name")) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue