[jOOQ/jOOQ#11850] Get SQLDialect.TERADATA up to date
- Fix dummy ordering of rankging functions - Avoid Statement.CLOSE_ALL_RESULTS - FOR XML support - Generate meta data for views (table type and sources) - Fixed fetchExists() ([jOOQ/jOOQ#11857]) - Support LISTAGG ([jOOQ/jOOQ#11861])
This commit is contained in:
parent
fc964fe9b3
commit
a4e0c95e5f
@ -54,6 +54,7 @@ import static org.jooq.SQLDialect.MYSQL;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ import static org.jooq.SQLDialect.MYSQL;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
|
||||
/**
|
||||
* This type is used for the {@link Select}'s DSL API when selecting generic
|
||||
|
||||
@ -127,5 +127,6 @@ import static org.jooq.SQLDialect.POSTGRES;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -120,5 +120,6 @@ import static org.jooq.SQLDialect.POSTGRES;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -152,5 +152,6 @@ import static org.jooq.SQLDialect.POSTGRES;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -42,6 +42,8 @@ import static org.jooq.impl.DSL.condition;
|
||||
import static org.jooq.impl.DSL.exists;
|
||||
import static org.jooq.impl.DSL.notExists;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Context;
|
||||
@ -180,4 +182,15 @@ abstract class AbstractCondition extends AbstractQueryPart implements Condition
|
||||
public /* non-final */ Condition not() {
|
||||
return new NotCondition(this);
|
||||
}
|
||||
|
||||
static final Condition unwrapNot(Condition c, BiFunction<? super Condition, ? super Boolean, ? extends Condition> function) {
|
||||
boolean not = false;
|
||||
|
||||
while (c instanceof NotCondition) {
|
||||
c = ((NotCondition) c).condition;
|
||||
not = !not;
|
||||
}
|
||||
|
||||
return function.apply(c, not);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,10 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
// ...
|
||||
import static org.jooq.impl.AbstractCondition.unwrapNot;
|
||||
import static org.jooq.impl.DSL.one;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.Keywords.K_CASE;
|
||||
import static org.jooq.impl.Keywords.K_ELSE;
|
||||
import static org.jooq.impl.Keywords.K_END;
|
||||
@ -201,8 +205,20 @@ final class CaseConditionStepImpl<T> extends AbstractField<T> implements CaseCon
|
||||
if (i > 0)
|
||||
ctx.formatSeparator();
|
||||
|
||||
ctx.visit(K_WHEN).sql(' ').visit(conditions.get(i)).sql(' ')
|
||||
.visit(K_THEN).sql(' ').visit(results.get(i));
|
||||
Condition c = conditions.get(i);
|
||||
Field<T> r = results.get(i);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctx.visit(K_WHEN).sql(' ').visit(c).sql(' ')
|
||||
.visit(K_THEN).sql(' ').visit(r);
|
||||
}
|
||||
|
||||
if (else_ != null)
|
||||
|
||||
@ -39,6 +39,7 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.inline;
|
||||
import static org.jooq.impl.DSL.not;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Context;
|
||||
@ -69,16 +70,7 @@ final class ConditionAsField extends AbstractField<Boolean> {
|
||||
|
||||
case CUBRID:
|
||||
case FIREBIRD:
|
||||
|
||||
// [#10179] Avoid 3VL when not necessary
|
||||
if (condition instanceof AbstractCondition && !((AbstractCondition) condition).isNullable())
|
||||
ctx.visit(DSL.when(condition, inline(true))
|
||||
.else_(inline(false)));
|
||||
|
||||
// [#3206] Implement 3VL if necessary or unknown
|
||||
else
|
||||
ctx.visit(DSL.when(condition, inline(true))
|
||||
.when(not(condition), inline(false)));
|
||||
acceptCase(ctx);
|
||||
break;
|
||||
|
||||
// Other dialects can inline predicates in column expression contexts
|
||||
@ -87,4 +79,17 @@ final class ConditionAsField extends AbstractField<Boolean> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private final void acceptCase(Context<?> ctx) {
|
||||
|
||||
// [#10179] Avoid 3VL when not necessary
|
||||
if (condition instanceof AbstractCondition && !((AbstractCondition) condition).isNullable())
|
||||
ctx.visit(DSL.when(condition, inline(true))
|
||||
.else_(inline(false)));
|
||||
|
||||
// [#3206] Implement 3VL if necessary or unknown
|
||||
else
|
||||
ctx.visit(DSL.when(condition, inline(true))
|
||||
.when(not(condition), inline(false)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ package org.jooq.impl;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
@ -53,7 +54,10 @@ import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.impl.DSL.sql;
|
||||
import static org.jooq.impl.Keywords.K_AS;
|
||||
import static org.jooq.impl.Keywords.K_CONTENT;
|
||||
import static org.jooq.impl.Keywords.K_DISTINCT;
|
||||
import static org.jooq.impl.Keywords.K_SEPARATOR;
|
||||
import static org.jooq.impl.Names.N_CONCAT;
|
||||
@ -65,6 +69,8 @@ import static org.jooq.impl.Names.N_SUBSTR;
|
||||
import static org.jooq.impl.Names.N_XMLAGG;
|
||||
import static org.jooq.impl.Names.N_XMLSERIALIZE;
|
||||
import static org.jooq.impl.Names.N_XMLTEXT;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.impl.SQLDataType.XML;
|
||||
import static org.jooq.impl.Tools.castIfNeeded;
|
||||
|
||||
import java.util.Set;
|
||||
@ -73,6 +79,7 @@ import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
// ...
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.XML;
|
||||
// ...
|
||||
|
||||
/**
|
||||
@ -116,10 +123,8 @@ final class ListAgg extends DefaultAggregateFunction<String> {
|
||||
|
||||
|
||||
|
||||
|
||||
else {
|
||||
else
|
||||
super.accept(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,16 +205,6 @@ final class ListAgg extends DefaultAggregateFunction<String> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@ import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.conf.BackslashEscaping.DEFAULT;
|
||||
import static org.jooq.conf.BackslashEscaping.ON;
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
@ -4082,9 +4083,16 @@ final class Tools {
|
||||
log.warn("Maximum consumed results reached: " + maxConsumedResults + ". This is probably a bug. Please report to https://github.com/jOOQ/jOOQ/issues/new");
|
||||
|
||||
// Call this only when there was at least one ResultSet.
|
||||
// Otherwise, this call is not supported by ojdbc or CUBRID [#4440]
|
||||
if (anyResults && ctx.family() != CUBRID)
|
||||
if (anyResults) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctx.statement().getMoreResults(Statement.CLOSE_ALL_RESULTS);
|
||||
}
|
||||
|
||||
// [#6413] For consistency reasons, any exceptions that have been placed in ResultOrRow elements must
|
||||
// be linked, just as if they were collected using ThrowExceptions == THROW_ALL
|
||||
|
||||
@ -56,6 +56,7 @@ import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.impl.DSL.field;
|
||||
import static org.jooq.impl.DSL.one;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user