mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
Merge pull request #1063 from querydsl/i1061
Wrap RelationalFunctionCalls in joins for HSQLDB
This commit is contained in:
commit
813032ccbf
@ -47,6 +47,7 @@ public class HSQLDBTemplates extends SQLTemplates {
|
||||
setLimitRequired(true);
|
||||
setAutoIncrement(" identity");
|
||||
setDefaultValues("\ndefault values");
|
||||
setFunctionJoinsWrapped(true);
|
||||
add(Ops.TRIM, "trim(both from {0})");
|
||||
add(Ops.NEGATE, "{0} * -1", 7);
|
||||
|
||||
|
||||
@ -826,7 +826,8 @@ public class SQLSerializer extends SerializerBase<SQLSerializer> {
|
||||
|
||||
@Override
|
||||
public Void visit(TemplateExpression<?> expr, Void context) {
|
||||
if (inJoin && templates.isFunctionJoinsWrapped()) {
|
||||
if (inJoin && expr instanceof RelationalFunctionCall
|
||||
&& templates.isFunctionJoinsWrapped()) {
|
||||
append("table(");
|
||||
super.visit(expr, context);
|
||||
append(")");
|
||||
|
||||
@ -138,6 +138,19 @@ public class SerializationTest {
|
||||
"on not SURVEY.NAME like tokFunc.prop escape '\\'", q.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FunctionCall3() {
|
||||
RelationalFunctionCall<String> func = RelationalFunctionCall.create(String.class, "TableValuedFunction", "parameter");
|
||||
PathBuilder<String> funcAlias = new PathBuilder<String>(String.class, "tokFunc");
|
||||
SQLQuery q = new SQLQuery(new HSQLDBTemplates());
|
||||
q.from(survey)
|
||||
.join(func, funcAlias).on(survey.name.like(funcAlias.getString("prop")).not());
|
||||
|
||||
assertEquals("from SURVEY SURVEY\n" +
|
||||
"join table(TableValuedFunction(?)) as tokFunc\n" +
|
||||
"on not SURVEY.NAME like tokFunc.prop escape '\\'", q.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Union() {
|
||||
SQLQuery q = new SQLQuery(SQLTemplates.DEFAULT);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user