[#629] Add support for the Teradata database (WIP)
This commit is contained in:
parent
1ad67a1620
commit
3b53630cbb
@ -76,6 +76,7 @@ final class Euler extends AbstractFunction<BigDecimal> {
|
||||
|
||||
|
||||
|
||||
|
||||
case CUBRID:
|
||||
case DERBY:
|
||||
case FIREBIRD:
|
||||
|
||||
@ -87,6 +87,7 @@ final class FieldCondition extends AbstractCondition {
|
||||
|
||||
|
||||
|
||||
|
||||
return (QueryPartInternal) condition("{0} = {1}", field, inline(true));
|
||||
|
||||
|
||||
|
||||
@ -282,6 +282,7 @@ final class Limit extends AbstractQueryPart {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// [#4785] OFFSET cannot be without LIMIT
|
||||
|
||||
@ -73,6 +73,7 @@ final class Pi extends AbstractFunction<BigDecimal> {
|
||||
|
||||
|
||||
|
||||
|
||||
case SQLITE:
|
||||
return inline(Math.PI, BigDecimal.class);
|
||||
|
||||
|
||||
@ -81,6 +81,9 @@ final class Replace extends AbstractFunction<String> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case FIREBIRD:
|
||||
@ -88,18 +91,14 @@ final class Replace extends AbstractFunction<String> {
|
||||
case MARIADB:
|
||||
case MYSQL:
|
||||
case POSTGRES:
|
||||
case SQLITE: {
|
||||
if (args.length == 2) {
|
||||
case SQLITE:
|
||||
if (args.length == 2)
|
||||
return function("replace", VARCHAR, args[0], args[1], val(""));
|
||||
}
|
||||
else {
|
||||
else
|
||||
return function("replace", VARCHAR, args);
|
||||
}
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
return function("replace", VARCHAR, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,6 +210,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
|
||||
|
||||
|
||||
private final WithImpl with;
|
||||
private final SelectFieldList<SelectFieldOrAsterisk> select;
|
||||
private Table<?> into;
|
||||
@ -607,6 +608,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case CUBRID:
|
||||
@ -903,15 +905,14 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
.visit(getLimit().getLowerRownum());
|
||||
|
||||
if (!getLimit().limitZero())
|
||||
ctx.formatSeparator()
|
||||
.visit(K_AND).sql(' ')
|
||||
.visit(name("rn"))
|
||||
.sql(" <= ")
|
||||
.visit(getLimit().getUpperRownum());
|
||||
ctx.formatSeparator()
|
||||
.visit(K_AND).sql(' ')
|
||||
.visit(name("rn"))
|
||||
.sql(" <= ")
|
||||
.visit(getLimit().getUpperRownum());
|
||||
|
||||
// [#5068] Don't rely on nested query's ordering. In most cases, the
|
||||
// ordering is stable, but in some cases (DISTINCT + JOIN) it is
|
||||
// not.
|
||||
// [#5068] Don't rely on nested query's ordering in case an operation
|
||||
// like DISTINCT or JOIN produces hashing.
|
||||
if (!ctx.subquery())
|
||||
ctx.formatSeparator()
|
||||
.visit(K_ORDER_BY)
|
||||
@ -1440,14 +1441,14 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
}
|
||||
|
||||
private final void toSQLOrderBy(
|
||||
Context<?> context,
|
||||
Context<?> ctx,
|
||||
Field<?>[] originalFields, Field<?>[] alternativeFields,
|
||||
boolean wrapQueryExpressionInDerivedTable, boolean wrapQueryExpressionBodyInDerivedTable,
|
||||
SortFieldList actualOrderBy,
|
||||
Limit actualLimit
|
||||
) {
|
||||
|
||||
context.start(SELECT_ORDER_BY);
|
||||
ctx.start(SELECT_ORDER_BY);
|
||||
|
||||
// [#6197] When emulating WITH TIES using RANK() in a subquery, we must avoid rendering the
|
||||
// subquery's ORDER BY clause
|
||||
@ -1461,14 +1462,14 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
) {
|
||||
if (!actualOrderBy.isEmpty()) {
|
||||
context.formatSeparator()
|
||||
.visit(K_ORDER);
|
||||
ctx.formatSeparator()
|
||||
.visit(K_ORDER);
|
||||
|
||||
if (orderBySiblings)
|
||||
context.sql(' ').visit(K_SIBLINGS);
|
||||
ctx.sql(' ').visit(K_SIBLINGS);
|
||||
|
||||
context.sql(' ').visit(K_BY)
|
||||
.sql(' ');
|
||||
ctx.sql(' ').visit(K_BY)
|
||||
.sql(' ');
|
||||
|
||||
|
||||
|
||||
@ -1490,7 +1491,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
|
||||
{
|
||||
context.visit(actualOrderBy);
|
||||
ctx.visit(actualOrderBy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1507,15 +1508,15 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
}
|
||||
|
||||
context.end(SELECT_ORDER_BY);
|
||||
ctx.end(SELECT_ORDER_BY);
|
||||
|
||||
if (wrapQueryExpressionInDerivedTable)
|
||||
context.formatIndentEnd()
|
||||
.formatNewLine()
|
||||
.sql(") x");
|
||||
ctx.formatIndentEnd()
|
||||
.formatNewLine()
|
||||
.sql(") x");
|
||||
|
||||
if (context.data().containsKey(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE) && actualLimit.isApplicable())
|
||||
context.visit(actualLimit);
|
||||
if (ctx.data().containsKey(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE) && actualLimit.isApplicable())
|
||||
ctx.visit(actualLimit);
|
||||
}
|
||||
|
||||
private final boolean wrapQueryExpressionBodyInDerivedTable(Context<?> ctx) {
|
||||
@ -1577,8 +1578,6 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user