[jOOQ/jOOQ#2620] Support Google BigQuery - WIP
This commit is contained in:
parent
ad21db797a
commit
a4c7c2f6bb
@ -42,6 +42,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
|
||||
@ -76,5 +76,6 @@ package org.jooq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
|
||||
@ -43,6 +43,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
@ -79,7 +80,6 @@ import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -10541,7 +10541,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#dropView(String)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
|
||||
DropViewFinalStep dropView(@Stringly.Name String view);
|
||||
|
||||
/**
|
||||
@ -10550,7 +10550,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#dropView(Name)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
|
||||
DropViewFinalStep dropView(Name view);
|
||||
|
||||
/**
|
||||
@ -10559,7 +10559,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#dropView(Table)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
|
||||
DropViewFinalStep dropView(Table<?> view);
|
||||
|
||||
/**
|
||||
|
||||
@ -40,15 +40,31 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
import static org.jooq.SQLDialect.IGNITE;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.Collection;
|
||||
|
||||
@ -130,5 +130,6 @@ import org.jetbrains.annotations.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
|
||||
@ -77,5 +77,6 @@ package org.jooq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ import org.jetbrains.annotations.*;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
|
||||
@ -43,6 +43,7 @@ import org.jetbrains.annotations.*;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
|
||||
@ -85,5 +85,6 @@ package org.jooq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -78,5 +78,6 @@ package org.jooq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
// ...
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
|
||||
@ -42,6 +42,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
|
||||
@ -42,6 +42,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
|
||||
@ -117,5 +117,6 @@ package org.jooq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
|
||||
@ -39,7 +39,7 @@ package org.jooq;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
|
||||
@ -40,6 +40,7 @@ package org.jooq;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
|
||||
@ -44,6 +44,7 @@ import static java.lang.Boolean.TRUE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
|
||||
@ -47,6 +47,7 @@ import static org.jooq.impl.SQLDataType.CLOB;
|
||||
import static org.jooq.impl.SQLDataType.NCHAR;
|
||||
import static org.jooq.impl.SQLDataType.NCLOB;
|
||||
import static org.jooq.impl.SQLDataType.NVARCHAR;
|
||||
import static org.jooq.impl.Tools.NO_SUPPORT_BINARY_TYPE_LENGTH;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.math.BigDecimal;
|
||||
@ -100,8 +101,8 @@ abstract class AbstractDataType<T> extends AbstractNamed implements DataType<T>
|
||||
/**
|
||||
* Generated UID
|
||||
*/
|
||||
private static final long serialVersionUID = 4155588654449505119L;
|
||||
private static final Set<SQLDialect> NO_SUPPORT_TIMESTAMP_PRECISION = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
private static final long serialVersionUID = 4155588654449505119L;
|
||||
static final Set<SQLDialect> NO_SUPPORT_TIMESTAMP_PRECISION = SQLDialect.supportedBy(DERBY, FIREBIRD);
|
||||
|
||||
AbstractDataType(Name name, Comment comment) {
|
||||
super(name, comment);
|
||||
@ -429,7 +430,14 @@ abstract class AbstractDataType<T> extends AbstractNamed implements DataType<T>
|
||||
// a null value, historically, so removing this check would
|
||||
// introduce a lot of regressions!
|
||||
if (lengthDefined() && length() > 0) {
|
||||
return castTypePrefix0() + "(" + length() + ")" + castTypeSuffix0();
|
||||
if (isBinary() && NO_SUPPORT_BINARY_TYPE_LENGTH.contains(dialect))
|
||||
return castTypeName0();
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
return castTypePrefix0() + "(" + length() + ")" + castTypeSuffix0();
|
||||
}
|
||||
else if (precisionDefined() && (isTimestamp() || precision() > 0)) {
|
||||
|
||||
@ -444,6 +452,8 @@ abstract class AbstractDataType<T> extends AbstractNamed implements DataType<T>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else if (scaleDefined() && scale() > 0)
|
||||
return castTypePrefix0() + "(" + precision() + ", " + scale() + ")" + castTypeSuffix0();
|
||||
else
|
||||
|
||||
@ -93,6 +93,7 @@ import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.DSL.sql;
|
||||
// ...
|
||||
import static org.jooq.impl.Keywords.K_ADD;
|
||||
import static org.jooq.impl.Keywords.K_ADD_COLUMN;
|
||||
import static org.jooq.impl.Keywords.K_AFTER;
|
||||
import static org.jooq.impl.Keywords.K_ALTER;
|
||||
import static org.jooq.impl.Keywords.K_ALTER_COLUMN;
|
||||
@ -185,10 +186,12 @@ import org.jooq.DataType;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.FieldOrConstraint;
|
||||
import org.jooq.Index;
|
||||
import org.jooq.Keyword;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Nullability;
|
||||
// ...
|
||||
import org.jooq.Query;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.Record1;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.Select;
|
||||
@ -1272,7 +1275,7 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
boolean comma = true ;
|
||||
|
||||
ctx.start(ALTER_TABLE_ADD)
|
||||
.visit(K_ADD)
|
||||
.visit(addColumnKeyword(ctx))
|
||||
.sql(' ');
|
||||
|
||||
if (parens)
|
||||
@ -1285,11 +1288,12 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
.formatNewLine();
|
||||
|
||||
for (int i = 0; i < add.size(); i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
ctx.sql(comma ? "," : "").formatSeparator();
|
||||
|
||||
if (multiAdd)
|
||||
ctx.sql(comma ? "," : "").formatSeparator().visit(K_ADD).sql(' ');
|
||||
else
|
||||
ctx.sql(comma ? "," : "").formatSeparator();
|
||||
ctx.visit(addColumnKeyword(ctx)).sql(' ');
|
||||
}
|
||||
|
||||
FieldOrConstraint part = add.get(i);
|
||||
ctx.qualify(false, c -> c.visit(part));
|
||||
@ -1312,12 +1316,7 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
else if (addColumn != null) {
|
||||
ctx.start(ALTER_TABLE_ADD)
|
||||
.visit(K_ADD).sql(' ');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.visit(addColumnKeyword(ctx)).sql(' ');
|
||||
|
||||
if (ifNotExistsColumn && supportsIfNotExistsColumn(ctx))
|
||||
ctx.visit(K_IF_NOT_EXISTS).sql(' ');
|
||||
@ -1647,6 +1646,15 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
ctx.formatIndentEnd();
|
||||
}
|
||||
|
||||
private final Keyword addColumnKeyword(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return K_ADD;
|
||||
}
|
||||
|
||||
private final void acceptCascade(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
case H2:
|
||||
|
||||
@ -37,14 +37,18 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.impl.Keywords.K_EXCEPT;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jooq.Asterisk;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.SQLDialect;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
@ -54,8 +58,9 @@ final class AsteriskImpl extends AbstractQueryPart implements Asterisk {
|
||||
/**
|
||||
* Generated UI
|
||||
*/
|
||||
private static final long serialVersionUID = 6298415939984684260L;
|
||||
static final AsteriskImpl INSTANCE = new AsteriskImpl(new QueryPartList<>());
|
||||
private static final long serialVersionUID = 6298415939984684260L;
|
||||
static final AsteriskImpl INSTANCE = new AsteriskImpl(new QueryPartList<>());
|
||||
static final Set<SQLDialect> SUPPORT_NATIVE_EXCEPT = SQLDialect.supportedBy(H2);
|
||||
final QueryPartList<Field<?>> fields;
|
||||
|
||||
private AsteriskImpl(QueryPartList<Field<?>> fields) {
|
||||
|
||||
@ -159,5 +159,6 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -9316,7 +9316,7 @@ public class DSL {
|
||||
* @see DSLContext#dropView(String)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
|
||||
public static org.jooq.DropViewFinalStep dropView(@Stringly.Name String view) {
|
||||
return dsl().dropView(view);
|
||||
}
|
||||
@ -9331,7 +9331,7 @@ public class DSL {
|
||||
* @see DSLContext#dropView(Name)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
|
||||
public static org.jooq.DropViewFinalStep dropView(Name view) {
|
||||
return dsl().dropView(view);
|
||||
}
|
||||
@ -9346,7 +9346,7 @@ public class DSL {
|
||||
* @see DSLContext#dropView(Table)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
|
||||
public static org.jooq.DropViewFinalStep dropView(Table<?> view) {
|
||||
return dsl().dropView(view);
|
||||
}
|
||||
|
||||
@ -615,7 +615,8 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
case CUBRID:
|
||||
|
||||
// [#1029] Postgres and [#632] Sybase need explicit casting
|
||||
// in very rare cases.
|
||||
// in very rare cases. BigQuery doesn't support NULL BOOLEAN or INT64 bind values
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1743,6 +1744,9 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
return Types.BOOLEAN;
|
||||
}
|
||||
@ -1792,6 +1796,11 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final int sqltype(Statement statement, Configuration configuration) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Types.TINYINT;
|
||||
}
|
||||
}
|
||||
@ -2353,6 +2362,8 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Types.DOUBLE;
|
||||
}
|
||||
}
|
||||
@ -2523,6 +2534,8 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Types.FLOAT;
|
||||
}
|
||||
}
|
||||
@ -2570,6 +2583,11 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final int sqltype(Statement statement, Configuration configuration) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Types.INTEGER;
|
||||
}
|
||||
}
|
||||
@ -2623,6 +2641,11 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final int sqltype(Statement statement, Configuration configuration) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Types.BIGINT;
|
||||
}
|
||||
}
|
||||
@ -3712,6 +3735,11 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final int sqltype(Statement statement, Configuration configuration) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Types.SMALLINT;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,6 +44,8 @@ import static org.jooq.impl.Keywords.K_AS;
|
||||
import static org.jooq.impl.Keywords.K_FROM;
|
||||
import static org.jooq.impl.Keywords.K_LIMIT;
|
||||
import static org.jooq.impl.Keywords.K_SELECT;
|
||||
import static org.jooq.impl.Keywords.K_STRUCT;
|
||||
import static org.jooq.impl.Keywords.K_UNNEST;
|
||||
import static org.jooq.impl.Keywords.K_WHERE;
|
||||
import static org.jooq.impl.Names.N_COUNT;
|
||||
import static org.jooq.impl.Names.N_DUAL;
|
||||
@ -134,7 +136,6 @@ final class Dual extends AbstractTable<Record> {
|
||||
|
||||
|
||||
|
||||
|
||||
case H2:
|
||||
case POSTGRES:
|
||||
case SQLITE:
|
||||
@ -190,6 +191,10 @@ final class Dual extends AbstractTable<Record> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -100,5 +100,6 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -160,5 +160,6 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -231,5 +231,6 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ final class Keywords {
|
||||
|
||||
static final Keyword K_ABSENT = keyword("absent");
|
||||
static final Keyword K_ADD = keyword("add");
|
||||
static final Keyword K_ADD_COLUMN = keyword("add column");
|
||||
static final Keyword K_AFTER = keyword("after");
|
||||
static final Keyword K_ALIAS = keyword("alias");
|
||||
static final Keyword K_ALL = keyword("all");
|
||||
|
||||
@ -386,5 +386,6 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ package org.jooq.impl;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
|
||||
@ -102,6 +102,7 @@ import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SortOrder.DESC;
|
||||
import static org.jooq.impl.AsteriskImpl.SUPPORT_NATIVE_EXCEPT;
|
||||
import static org.jooq.impl.CombineOperator.EXCEPT;
|
||||
import static org.jooq.impl.CombineOperator.EXCEPT_ALL;
|
||||
import static org.jooq.impl.CombineOperator.INTERSECT;
|
||||
@ -288,6 +289,8 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static final Set<SQLDialect> SUPPORT_FULL_WITH_TIES = SQLDialect.supportedBy(H2, POSTGRES);
|
||||
private static final Set<SQLDialect> EMULATE_DISTINCT_ON = SQLDialect.supportedBy(DERBY, FIREBIRD, HSQLDB, MARIADB, MYSQL, SQLITE);
|
||||
|
||||
@ -1984,7 +1987,21 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
// [#....] Some SQL dialects do not require a FROM clause. Others do and
|
||||
// jOOQ generates a "DUAL" table or something equivalent.
|
||||
// See also org.jooq.impl.Dual for details.
|
||||
boolean hasFrom = !getFrom().isEmpty() || !OPTIONAL_FROM_CLAUSE.contains(context.dialect());
|
||||
boolean hasFrom = !getFrom().isEmpty()
|
||||
|| !OPTIONAL_FROM_CLAUSE.contains(context.dialect())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
List<Condition> semiAntiJoinPredicates = null;
|
||||
ConditionProviderImpl where = getWhere();
|
||||
|
||||
@ -3361,7 +3378,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
SelectFieldList<SelectFieldOrAsterisk> result = new SelectFieldList<>();
|
||||
|
||||
// [#7921] Only H2 supports the * EXCEPT (..) syntax
|
||||
boolean resolveExcept = resolveSupported || c.family() != H2;
|
||||
boolean resolveExcept = resolveSupported || !SUPPORT_NATIVE_EXCEPT.contains(c.dialect());
|
||||
|
||||
// [#7921] TODO Find a better, more efficient way to resolve asterisks
|
||||
for (SelectFieldOrAsterisk f : getSelectResolveImplicitAsterisks())
|
||||
|
||||
@ -77,27 +77,20 @@ import static org.jooq.conf.SettingsTools.reflectionCaching;
|
||||
import static org.jooq.conf.SettingsTools.updatablePrimaryKeys;
|
||||
import static org.jooq.conf.ThrowExceptions.THROW_FIRST;
|
||||
import static org.jooq.conf.ThrowExceptions.THROW_NONE;
|
||||
import static org.jooq.impl.DDLStatementType.ALTER_INDEX;
|
||||
import static org.jooq.impl.DDLStatementType.ALTER_SCHEMA;
|
||||
import static org.jooq.impl.DDLStatementType.ALTER_SEQUENCE;
|
||||
import static org.jooq.impl.DDLStatementType.ALTER_TABLE;
|
||||
import static org.jooq.impl.DDLStatementType.ALTER_VIEW;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_DATABASE;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_DOMAIN;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_FUNCTION;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_INDEX;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_PROCEDURE;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_SCHEMA;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_SEQUENCE;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_TABLE;
|
||||
import static org.jooq.impl.DDLStatementType.CREATE_VIEW;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_FUNCTION;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_INDEX;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_PROCEDURE;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_SCHEMA;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_SEQUENCE;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_TABLE;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_TRIGGER;
|
||||
import static org.jooq.impl.DDLStatementType.DROP_VIEW;
|
||||
import static org.jooq.impl.DSL.asterisk;
|
||||
import static org.jooq.impl.DSL.concat;
|
||||
@ -106,6 +99,7 @@ import static org.jooq.impl.DSL.getDataType;
|
||||
import static org.jooq.impl.DSL.jsonEntry;
|
||||
import static org.jooq.impl.DSL.keyword;
|
||||
import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.DSL.noCondition;
|
||||
import static org.jooq.impl.DSL.row;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.DSL.val;
|
||||
@ -133,6 +127,7 @@ import static org.jooq.impl.Keywords.K_END_CATCH;
|
||||
import static org.jooq.impl.Keywords.K_END_IF;
|
||||
import static org.jooq.impl.Keywords.K_END_TRY;
|
||||
import static org.jooq.impl.Keywords.K_ENUM;
|
||||
import static org.jooq.impl.Keywords.K_ERROR;
|
||||
import static org.jooq.impl.Keywords.K_EXCEPTION;
|
||||
import static org.jooq.impl.Keywords.K_EXEC;
|
||||
import static org.jooq.impl.Keywords.K_EXECUTE_BLOCK;
|
||||
@ -729,51 +724,51 @@ final class Tools {
|
||||
* The default escape character for <code>[a] LIKE [b] ESCAPE [...]</code>
|
||||
* clauses.
|
||||
*/
|
||||
static final char ESCAPE = '!';
|
||||
static final char ESCAPE = '!';
|
||||
|
||||
/**
|
||||
* A lock for the initialisation of other static members
|
||||
*/
|
||||
private static final Object initLock = new Object();
|
||||
private static final Object initLock = new Object();
|
||||
|
||||
/**
|
||||
* Indicating whether JPA (<code>javax.persistence</code>) is on the
|
||||
* classpath.
|
||||
*/
|
||||
private static volatile Boolean isJPAAvailable;
|
||||
private static volatile Boolean isJPAAvailable;
|
||||
|
||||
/**
|
||||
* Indicating whether Kotlin (<code>kotlin.*</code>) is on the classpath.
|
||||
*/
|
||||
private static volatile Boolean isKotlinAvailable;
|
||||
private static volatile Reflect ktJvmClassMapping;
|
||||
private static volatile Reflect ktKClasses;
|
||||
private static volatile Reflect ktKClass;
|
||||
private static volatile Reflect ktKTypeParameter;
|
||||
private static volatile Boolean isKotlinAvailable;
|
||||
private static volatile Reflect ktJvmClassMapping;
|
||||
private static volatile Reflect ktKClasses;
|
||||
private static volatile Reflect ktKClass;
|
||||
private static volatile Reflect ktKTypeParameter;
|
||||
|
||||
/**
|
||||
* [#3696] The maximum number of consumed exceptions in
|
||||
* {@link #consumeExceptions(Configuration, PreparedStatement, SQLException)}
|
||||
* helps prevent infinite loops and {@link OutOfMemoryError}.
|
||||
*/
|
||||
static int maxForceSettingsAttempts = 16;
|
||||
static int maxConsumedExceptions = 256;
|
||||
static int maxConsumedResults = 65536;
|
||||
static int maxForceSettingsAttempts = 16;
|
||||
static int maxConsumedExceptions = 256;
|
||||
static int maxConsumedResults = 65536;
|
||||
|
||||
/**
|
||||
* A pattern for the dash line syntax
|
||||
*/
|
||||
private static final Pattern DASH_PATTERN = Pattern.compile("(-+)");
|
||||
private static final Pattern DASH_PATTERN = Pattern.compile("(-+)");
|
||||
|
||||
/**
|
||||
* A pattern for the pipe line syntax
|
||||
*/
|
||||
private static final Pattern PIPE_PATTERN = Pattern.compile("(?<=\\|)([^|]+)(?=\\|)");
|
||||
private static final Pattern PIPE_PATTERN = Pattern.compile("(?<=\\|)([^|]+)(?=\\|)");
|
||||
|
||||
/**
|
||||
* A pattern for the dash line syntax
|
||||
*/
|
||||
private static final Pattern PLUS_PATTERN = Pattern.compile("\\+(-+)(?=\\+)");
|
||||
private static final Pattern PLUS_PATTERN = Pattern.compile("\\+(-+)(?=\\+)");
|
||||
|
||||
/**
|
||||
* All characters that are matched by Java's interpretation of \s.
|
||||
@ -783,25 +778,25 @@ final class Tools {
|
||||
* processing, it is probably safe to ignore most of those alternative
|
||||
* Unicode whitespaces.
|
||||
*/
|
||||
private static final char[] WHITESPACE_CHARACTERS = " \t\n\u000B\f\r".toCharArray();
|
||||
private static final char[] WHITESPACE_CHARACTERS = " \t\n\u000B\f\r".toCharArray();
|
||||
|
||||
/**
|
||||
* Acceptable prefixes for JDBC escape syntax.
|
||||
*/
|
||||
private static final char[][] JDBC_ESCAPE_PREFIXES = {
|
||||
private static final char[][] JDBC_ESCAPE_PREFIXES = {
|
||||
"{fn ".toCharArray(),
|
||||
"{d ".toCharArray(),
|
||||
"{t ".toCharArray(),
|
||||
"{ts ".toCharArray()
|
||||
};
|
||||
|
||||
private static final char[] TOKEN_SINGLE_LINE_COMMENT = { '-', '-' };
|
||||
private static final char[] TOKEN_SINGLE_LINE_COMMENT_C = { '/', '/' };
|
||||
private static final char[] TOKEN_HASH = { '#' };
|
||||
private static final char[] TOKEN_MULTI_LINE_COMMENT_OPEN = { '/', '*' };
|
||||
private static final char[] TOKEN_MULTI_LINE_COMMENT_CLOSE = { '*', '/' };
|
||||
private static final char[] TOKEN_APOS = { '\'' };
|
||||
private static final char[] TOKEN_ESCAPED_APOS = { '\'', '\'' };
|
||||
private static final char[] TOKEN_SINGLE_LINE_COMMENT = { '-', '-' };
|
||||
private static final char[] TOKEN_SINGLE_LINE_COMMENT_C = { '/', '/' };
|
||||
private static final char[] TOKEN_HASH = { '#' };
|
||||
private static final char[] TOKEN_MULTI_LINE_COMMENT_OPEN = { '/', '*' };
|
||||
private static final char[] TOKEN_MULTI_LINE_COMMENT_CLOSE = { '*', '/' };
|
||||
private static final char[] TOKEN_APOS = { '\'' };
|
||||
private static final char[] TOKEN_ESCAPED_APOS = { '\'', '\'' };
|
||||
|
||||
/**
|
||||
* "Suffixes" that are placed behind a "?" character to form an operator,
|
||||
@ -836,7 +831,7 @@ final class Tools {
|
||||
* <li>?|</li>
|
||||
* </ul>
|
||||
*/
|
||||
private static final char[][] NON_BIND_VARIABLE_SUFFIXES = {
|
||||
private static final char[][] NON_BIND_VARIABLE_SUFFIXES = {
|
||||
{ '?' },
|
||||
{ '|' },
|
||||
{ '&' },
|
||||
@ -855,7 +850,7 @@ final class Tools {
|
||||
* such as <code>"?<>"</code>, which is a non-equality operator, not
|
||||
* an operator on its own.
|
||||
*/
|
||||
private static final char[][] BIND_VARIABLE_SUFFIXES = {
|
||||
private static final char[][] BIND_VARIABLE_SUFFIXES = {
|
||||
{ '<', '>' }
|
||||
};
|
||||
|
||||
@ -863,16 +858,16 @@ final class Tools {
|
||||
* All hexadecimal digits accessible through array index, e.g.
|
||||
* <code>HEX_DIGITS[15] == 'f'</code>.
|
||||
*/
|
||||
private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
|
||||
private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
|
||||
|
||||
private static final Set<SQLDialect> REQUIRES_BACKSLASH_ESCAPING = SQLDialect.supportedBy(MARIADB, MYSQL);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_NULL = SQLDialect.supportedBy(DERBY, FIREBIRD, HSQLDB);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_BINARY_TYPE_LENGTH = SQLDialect.supportedBy(POSTGRES);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_CAST_TYPE_IN_DDL = SQLDialect.supportedBy(MARIADB, MYSQL);
|
||||
private static final Set<SQLDialect> SUPPORT_NON_BIND_VARIABLE_SUFFIXES = SQLDialect.supportedBy(POSTGRES);
|
||||
private static final Set<SQLDialect> DEFAULT_BEFORE_NULL = SQLDialect.supportedBy(FIREBIRD, HSQLDB);
|
||||
static final Set<SQLDialect> NO_SUPPORT_TIMESTAMP_PRECISION = SQLDialect.supportedBy(DERBY);
|
||||
private static final Set<SQLDialect> DEFAULT_TIMESTAMP_NOT_NULL = SQLDialect.supportedBy(MARIADB);
|
||||
static final Set<SQLDialect> REQUIRES_BACKSLASH_ESCAPING = SQLDialect.supportedBy(MARIADB, MYSQL);
|
||||
static final Set<SQLDialect> NO_SUPPORT_NULL = SQLDialect.supportedBy(DERBY, FIREBIRD, HSQLDB);
|
||||
static final Set<SQLDialect> NO_SUPPORT_BINARY_TYPE_LENGTH = SQLDialect.supportedBy(POSTGRES);
|
||||
static final Set<SQLDialect> NO_SUPPORT_CAST_TYPE_IN_DDL = SQLDialect.supportedBy(MARIADB, MYSQL);
|
||||
static final Set<SQLDialect> SUPPORT_NON_BIND_VARIABLE_SUFFIXES = SQLDialect.supportedBy(POSTGRES);
|
||||
static final Set<SQLDialect> DEFAULT_BEFORE_NULL = SQLDialect.supportedBy(FIREBIRD, HSQLDB);
|
||||
static final Set<SQLDialect> NO_SUPPORT_TIMESTAMP_PRECISION = SQLDialect.supportedBy(DERBY);
|
||||
static final Set<SQLDialect> DEFAULT_TIMESTAMP_NOT_NULL = SQLDialect.supportedBy(MARIADB);
|
||||
|
||||
|
||||
|
||||
@ -4727,6 +4722,56 @@ final class Tools {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user