[#2728] Add support for Amazon Redshift
This commit is contained in:
parent
954713d850
commit
f083198968
@ -53,12 +53,15 @@ import static org.jooq.Comparator.NOT_LIKE_IGNORE_CASE;
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Comparator;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.conf.ParamType;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
@ -115,6 +118,8 @@ class CompareCondition extends AbstractCondition {
|
||||
.sql(' ');
|
||||
|
||||
boolean castRhs = false;
|
||||
ParamType previousParamType = ctx.paramType();
|
||||
ParamType forcedParamType = previousParamType;
|
||||
|
||||
/* [pro] xx
|
||||
xx xxxxxxx xxxx xxxxx xxx xxxxx xxxxx xxxxxx xxxx xxxxxxx xxxx x
|
||||
@ -122,11 +127,18 @@ class CompareCondition extends AbstractCondition {
|
||||
xx xxxxxxxxxx xxxx
|
||||
xx xxxxxxx xx xxx xx xxx xxxxxxxxxx xxxxxxx
|
||||
xxxxxxx x xxxxx
|
||||
|
||||
xx xxxxxxxx xxx x xxx xxxx xxxx xxxxxxxxx xxx xxxx xxxx xxxxxxx
|
||||
xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xx xxxxxxx xx xxxxxxxx xx xxxxxx xx xxxxx
|
||||
xxxxxxxxxxxxxxx x xxxxxxxx
|
||||
xx [/pro] */
|
||||
|
||||
ctx.keyword(op.toSQL()).sql(' ');
|
||||
if (castRhs) ctx.keyword("cast").sql('(');
|
||||
ctx.visit(rhs);
|
||||
ctx.paramType(forcedParamType)
|
||||
.visit(rhs)
|
||||
.paramType(previousParamType);
|
||||
if (castRhs) ctx.sql(' ').keyword("as").sql(' ').keyword("varchar").sql("(4000))");
|
||||
|
||||
if (escape != null) {
|
||||
|
||||
@ -78,7 +78,6 @@ class DateAdd<T extends java.util.Date> extends AbstractFunction<T> {
|
||||
@Override
|
||||
final QueryPart getFunction0(Configuration configuration) {
|
||||
String keyword = null;
|
||||
String function = null;
|
||||
|
||||
switch (configuration.family()) {
|
||||
case CUBRID:
|
||||
@ -140,6 +139,13 @@ class DateAdd<T extends java.util.Date> extends AbstractFunction<T> {
|
||||
return field("{dateadd}({0}, {1}, {2})", getDataType(), inline(keyword), interval, date);
|
||||
}
|
||||
|
||||
/* [pro] xx
|
||||
xx xx xxxxxxx xxxx xxxxx xxxxxxxx xxxxxxxxxx xx xxxxxxxxxxx xxxx
|
||||
xx xxxxx xxxxxxx xx xxxxxxxx xx xxxxxxxxxxx xxxxx
|
||||
xx x xxxxxxxxxxxxxxx xx xxxx xxxxxxxxxxxxx x xxxxxxxxxx
|
||||
xx x xxxx xxxxxxxxxxxx x xx xxxxxxxxxxxxxxx x xxxxxxxxxx xxxxxxxxxx
|
||||
xxxx xxxxxxxxx
|
||||
xx [/pro] */
|
||||
case POSTGRES: {
|
||||
switch (datePart) {
|
||||
case YEAR: keyword = " year"; break;
|
||||
|
||||
@ -83,6 +83,9 @@ class DateDiff extends AbstractFunction<Integer> {
|
||||
|
||||
case H2:
|
||||
case HSQLDB:
|
||||
/* [pro] xx
|
||||
xxxx xxxxxxxxx
|
||||
xx [/pro] */
|
||||
return field("{datediff}('day', {0}, {1})", getDataType(), date2, date1);
|
||||
|
||||
case SQLITE:
|
||||
|
||||
@ -74,6 +74,7 @@ class Euler extends AbstractFunction<BigDecimal> {
|
||||
xxxx xxxxxxxxx
|
||||
xxxx xxxxxxx
|
||||
xxxx xxxxxxx
|
||||
xxxx xxxxxxxxx
|
||||
xxxx xxxxxxxxxx
|
||||
xxxx xxxxxxx
|
||||
xx [/pro] */
|
||||
|
||||
@ -460,6 +460,31 @@ class Expression<T> extends AbstractFunction<T> {
|
||||
xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxx xx xxx xxx xxxxxxxxxxxxxx
|
||||
x
|
||||
|
||||
xxxx xxxxxxxxx x
|
||||
xx xxxxxxxxxxxxxxxxxxxxx xx xxxxxxxxxxxxxxxxxx x
|
||||
xx xxxxxxxxx xx xxxx x
|
||||
xxxxxx xxxxxxxxxxxxxxxxxxx xx x xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
x
|
||||
xxxx x
|
||||
xxxxxx xxxxxxxxxxxxxxxxxxx xx x xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
x
|
||||
x
|
||||
xxxx x
|
||||
xxxxxxxxxxx xxxx x xxxxxxxxxxxxxxxxxx
|
||||
|
||||
xx xxxxxxxxx xx xxxx x
|
||||
xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxx xx x xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxx
|
||||
x
|
||||
xxxx x
|
||||
xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxx xx x xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxx
|
||||
x
|
||||
x
|
||||
x
|
||||
|
||||
xxxx xxxxxxx
|
||||
xx [/pro] */
|
||||
case POSTGRES:
|
||||
@ -576,6 +601,7 @@ class Expression<T> extends AbstractFunction<T> {
|
||||
x
|
||||
x
|
||||
|
||||
xxxx xxxxxxxxx
|
||||
xx [/pro] */
|
||||
case POSTGRES: {
|
||||
|
||||
|
||||
@ -122,6 +122,10 @@ class TruncDate<T extends java.util.Date> extends AbstractFunction<T> {
|
||||
// }
|
||||
// }
|
||||
|
||||
/* [pro] xx
|
||||
xxxx xxxxxxxxx
|
||||
xx [/pro] */
|
||||
|
||||
case POSTGRES: {
|
||||
switch (part) {
|
||||
case YEAR: keyword = "year"; break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user