[jOOQ/jOOQ#12407] Add a SQLDialect.YUGABYTE dialect (WIP)
This commit is contained in:
parent
be3f421e7e
commit
27e7162201
@ -9179,7 +9179,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#alterDatabaseIfExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ POSTGRES })
|
||||
@Support({ POSTGRES, YUGABYTE })
|
||||
AlterDatabaseStep alterDatabaseIfExists(@Stringly.Name String database);
|
||||
|
||||
/**
|
||||
@ -9188,7 +9188,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#alterDatabaseIfExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ POSTGRES })
|
||||
@Support({ POSTGRES, YUGABYTE })
|
||||
AlterDatabaseStep alterDatabaseIfExists(Name database);
|
||||
|
||||
/**
|
||||
@ -9197,7 +9197,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#alterDatabaseIfExists(Catalog)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ POSTGRES })
|
||||
@Support({ POSTGRES, YUGABYTE })
|
||||
AlterDatabaseStep alterDatabaseIfExists(Catalog database);
|
||||
|
||||
/**
|
||||
@ -9233,7 +9233,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#alterDomainIfExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES })
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, YUGABYTE })
|
||||
<T> AlterDomainStep<T> alterDomainIfExists(@Stringly.Name String domain);
|
||||
|
||||
/**
|
||||
@ -9242,7 +9242,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#alterDomainIfExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES })
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, YUGABYTE })
|
||||
<T> AlterDomainStep<T> alterDomainIfExists(Name domain);
|
||||
|
||||
/**
|
||||
@ -9251,7 +9251,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#alterDomainIfExists(Domain)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES })
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, YUGABYTE })
|
||||
<T> AlterDomainStep<T> alterDomainIfExists(Domain<T> domain);
|
||||
|
||||
/**
|
||||
@ -9602,7 +9602,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#createDatabaseIfNotExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ MARIADB, MYSQL })
|
||||
@Support({ MARIADB, MYSQL, YUGABYTE })
|
||||
CreateDatabaseFinalStep createDatabaseIfNotExists(@Stringly.Name String database);
|
||||
|
||||
/**
|
||||
@ -9611,7 +9611,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#createDatabaseIfNotExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ MARIADB, MYSQL })
|
||||
@Support({ MARIADB, MYSQL, YUGABYTE })
|
||||
CreateDatabaseFinalStep createDatabaseIfNotExists(Name database);
|
||||
|
||||
/**
|
||||
@ -9620,7 +9620,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#createDatabaseIfNotExists(Catalog)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ MARIADB, MYSQL })
|
||||
@Support({ MARIADB, MYSQL, YUGABYTE })
|
||||
CreateDatabaseFinalStep createDatabaseIfNotExists(Catalog database);
|
||||
|
||||
/**
|
||||
@ -9656,7 +9656,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#createDomainIfNotExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, H2, POSTGRES })
|
||||
@Support({ FIREBIRD, H2, POSTGRES, YUGABYTE })
|
||||
CreateDomainAsStep createDomainIfNotExists(@Stringly.Name String domain);
|
||||
|
||||
/**
|
||||
@ -9665,7 +9665,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#createDomainIfNotExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, H2, POSTGRES })
|
||||
@Support({ FIREBIRD, H2, POSTGRES, YUGABYTE })
|
||||
CreateDomainAsStep createDomainIfNotExists(Name domain);
|
||||
|
||||
/**
|
||||
@ -9674,7 +9674,7 @@ public interface DSLContext extends Scope {
|
||||
* @see DSL#createDomainIfNotExists(Domain)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, H2, POSTGRES })
|
||||
@Support({ FIREBIRD, H2, POSTGRES, YUGABYTE })
|
||||
CreateDomainAsStep createDomainIfNotExists(Domain<?> domain);
|
||||
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.YUGABYTE;
|
||||
import static org.jooq.XMLFormat.RecordFormat.COLUMN_NAME_ELEMENTS;
|
||||
import static org.jooq.conf.ThrowExceptions.THROW_NONE;
|
||||
import static org.jooq.impl.DSL.field;
|
||||
@ -167,6 +168,8 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
|
||||
|
||||
|
||||
private static final Set<SQLDialect> REQUIRE_SELECT_FROM = SQLDialect.supportedBy(POSTGRES, YUGABYTE);
|
||||
private static final Set<SQLDialect> REQUIRE_DISAMBIGUATE_OVERLOADS = SQLDialect.supportedBy(POSTGRES, YUGABYTE);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Meta-data attributes (the same for every call)
|
||||
@ -354,7 +357,8 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
|
||||
@Override
|
||||
public final int execute() {
|
||||
SQLDialect family = configurationOrThrow(this).family();
|
||||
Configuration config = configurationOrThrow(this);
|
||||
SQLDialect family = config.family();
|
||||
|
||||
results.clear();
|
||||
outValues.clear();
|
||||
@ -362,7 +366,7 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
// [#4254] In PostgreSQL, there are only functions, no procedures. Some
|
||||
// functions cannot be called using a CallableStatement, e.g. those with
|
||||
// DEFAULT parameters
|
||||
if ( family == POSTGRES) {
|
||||
if (REQUIRE_SELECT_FROM.contains(config.dialect())) {
|
||||
return executeSelectFromPOSTGRES();
|
||||
}
|
||||
|
||||
@ -2109,7 +2113,7 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
continue;
|
||||
|
||||
// Disambiguate overloaded function signatures
|
||||
if ( family == POSTGRES)
|
||||
if (REQUIRE_DISAMBIGUATE_OVERLOADS.contains(ctx.dialect()))
|
||||
|
||||
// [#4920] In case there are any unnamed parameters, we mustn't
|
||||
if (hasUnnamedParameters())
|
||||
|
||||
@ -7186,7 +7186,7 @@ public class DSL {
|
||||
* @see DSLContext#alterDatabaseIfExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ POSTGRES })
|
||||
@Support({ POSTGRES, YUGABYTE })
|
||||
public static org.jooq.AlterDatabaseStep alterDatabaseIfExists(@Stringly.Name String database) {
|
||||
return dsl().alterDatabaseIfExists(database);
|
||||
}
|
||||
@ -7201,7 +7201,7 @@ public class DSL {
|
||||
* @see DSLContext#alterDatabaseIfExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ POSTGRES })
|
||||
@Support({ POSTGRES, YUGABYTE })
|
||||
public static org.jooq.AlterDatabaseStep alterDatabaseIfExists(Name database) {
|
||||
return dsl().alterDatabaseIfExists(database);
|
||||
}
|
||||
@ -7216,7 +7216,7 @@ public class DSL {
|
||||
* @see DSLContext#alterDatabaseIfExists(Catalog)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ POSTGRES })
|
||||
@Support({ POSTGRES, YUGABYTE })
|
||||
public static org.jooq.AlterDatabaseStep alterDatabaseIfExists(Catalog database) {
|
||||
return dsl().alterDatabaseIfExists(database);
|
||||
}
|
||||
@ -7276,7 +7276,7 @@ public class DSL {
|
||||
* @see DSLContext#alterDomainIfExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES })
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, YUGABYTE })
|
||||
public static <T> org.jooq.AlterDomainStep<T> alterDomainIfExists(@Stringly.Name String domain) {
|
||||
return dsl().alterDomainIfExists(domain);
|
||||
}
|
||||
@ -7291,7 +7291,7 @@ public class DSL {
|
||||
* @see DSLContext#alterDomainIfExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES })
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, YUGABYTE })
|
||||
public static <T> org.jooq.AlterDomainStep<T> alterDomainIfExists(Name domain) {
|
||||
return dsl().alterDomainIfExists(domain);
|
||||
}
|
||||
@ -7306,7 +7306,7 @@ public class DSL {
|
||||
* @see DSLContext#alterDomainIfExists(Domain)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES })
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, YUGABYTE })
|
||||
public static <T> org.jooq.AlterDomainStep<T> alterDomainIfExists(Domain<T> domain) {
|
||||
return dsl().alterDomainIfExists(domain);
|
||||
}
|
||||
@ -7891,7 +7891,7 @@ public class DSL {
|
||||
* @see DSLContext#createDatabaseIfNotExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ MARIADB, MYSQL })
|
||||
@Support({ MARIADB, MYSQL, YUGABYTE })
|
||||
public static org.jooq.CreateDatabaseFinalStep createDatabaseIfNotExists(@Stringly.Name String database) {
|
||||
return dsl().createDatabaseIfNotExists(database);
|
||||
}
|
||||
@ -7906,7 +7906,7 @@ public class DSL {
|
||||
* @see DSLContext#createDatabaseIfNotExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ MARIADB, MYSQL })
|
||||
@Support({ MARIADB, MYSQL, YUGABYTE })
|
||||
public static org.jooq.CreateDatabaseFinalStep createDatabaseIfNotExists(Name database) {
|
||||
return dsl().createDatabaseIfNotExists(database);
|
||||
}
|
||||
@ -7921,7 +7921,7 @@ public class DSL {
|
||||
* @see DSLContext#createDatabaseIfNotExists(Catalog)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ MARIADB, MYSQL })
|
||||
@Support({ MARIADB, MYSQL, YUGABYTE })
|
||||
public static org.jooq.CreateDatabaseFinalStep createDatabaseIfNotExists(Catalog database) {
|
||||
return dsl().createDatabaseIfNotExists(database);
|
||||
}
|
||||
@ -7981,7 +7981,7 @@ public class DSL {
|
||||
* @see DSLContext#createDomainIfNotExists(String)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, H2, POSTGRES })
|
||||
@Support({ FIREBIRD, H2, POSTGRES, YUGABYTE })
|
||||
public static org.jooq.CreateDomainAsStep createDomainIfNotExists(@Stringly.Name String domain) {
|
||||
return dsl().createDomainIfNotExists(domain);
|
||||
}
|
||||
@ -7996,7 +7996,7 @@ public class DSL {
|
||||
* @see DSLContext#createDomainIfNotExists(Name)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, H2, POSTGRES })
|
||||
@Support({ FIREBIRD, H2, POSTGRES, YUGABYTE })
|
||||
public static org.jooq.CreateDomainAsStep createDomainIfNotExists(Name domain) {
|
||||
return dsl().createDomainIfNotExists(domain);
|
||||
}
|
||||
@ -8011,7 +8011,7 @@ public class DSL {
|
||||
* @see DSLContext#createDomainIfNotExists(Domain)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, H2, POSTGRES })
|
||||
@Support({ FIREBIRD, H2, POSTGRES, YUGABYTE })
|
||||
public static org.jooq.CreateDomainAsStep createDomainIfNotExists(Domain<?> domain) {
|
||||
return dsl().createDomainIfNotExists(domain);
|
||||
}
|
||||
|
||||
@ -50,6 +50,7 @@ import static org.jooq.SQLDialect.HSQLDB;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.YUGABYTE;
|
||||
import static org.jooq.impl.DefaultMetaProvider.meta;
|
||||
import static org.jooq.impl.Internal.createPathAlias;
|
||||
import static org.jooq.impl.Keywords.K_TABLE;
|
||||
@ -91,7 +92,7 @@ public class TableImpl<R extends Record> extends AbstractTable<R> implements Sco
|
||||
|
||||
private static final Clause[] CLAUSES_TABLE_REFERENCE = { TABLE, TABLE_REFERENCE };
|
||||
private static final Clause[] CLAUSES_TABLE_ALIAS = { TABLE, TABLE_ALIAS };
|
||||
private static final Set<SQLDialect> NO_SUPPORT_QUALIFIED_TVF_CALLS = SQLDialect.supportedBy(HSQLDB, POSTGRES);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_QUALIFIED_TVF_CALLS = SQLDialect.supportedBy(HSQLDB, POSTGRES, YUGABYTE);
|
||||
private static final Set<SQLDialect> REQUIRES_TVF_TABLE_CONSTRUCTOR = SQLDialect.supportedBy(HSQLDB);
|
||||
|
||||
|
||||
|
||||
@ -4555,6 +4555,7 @@ final class Tools {
|
||||
|
||||
|
||||
case POSTGRES:
|
||||
case YUGABYTE:
|
||||
if (increment(ctx.data(), DATA_BLOCK_NESTING))
|
||||
ctx.visit(K_DO).sql(" $$").formatSeparator();
|
||||
|
||||
@ -4586,6 +4587,7 @@ final class Tools {
|
||||
|
||||
|
||||
case POSTGRES:
|
||||
case YUGABYTE:
|
||||
ctx.formatIndentEnd().formatSeparator()
|
||||
.visit(K_END);
|
||||
|
||||
@ -4985,7 +4987,8 @@ final class Tools {
|
||||
}
|
||||
|
||||
|
||||
case POSTGRES: {
|
||||
case POSTGRES:
|
||||
case YUGABYTE: {
|
||||
begin(ctx, c -> {
|
||||
String sqlstate;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user