[jOOQ/jOOQ#15732] Support NEXTVAL, CURRVAL, sequence codegen, etc.
This commit is contained in:
parent
eb7edf7715
commit
15c182bfdb
@ -130,14 +130,6 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab
|
||||
ctx.settings().setRenderMapping(new RenderMapping()
|
||||
.withDefaultCatalog(DUCKDB_TABLES.getCatalog().getName())
|
||||
.withDefaultSchema(DUCKDB_TABLES.getSchema().getName())
|
||||
// .withCatalogs(new MappedCatalog()
|
||||
// .withInput(DUCKDB_TABLES.getCatalog().getName())
|
||||
// .withOutput("")
|
||||
// .withSchemata(new MappedSchema()
|
||||
// .withInput(DUCKDB_TABLES.getSchema().getName())
|
||||
// .withOutput("")
|
||||
// )
|
||||
// )
|
||||
);
|
||||
return ctx;
|
||||
}
|
||||
@ -377,7 +369,7 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab
|
||||
cycle,
|
||||
0 as cache
|
||||
from duckdb_sequences()
|
||||
where sequence_name in ({0})
|
||||
where schema_name in ({0})
|
||||
""",
|
||||
DSL.list(schemas.stream().map(DSL::val).collect(toList()))
|
||||
)
|
||||
|
||||
@ -12508,7 +12508,7 @@ public interface DSLContext extends Scope {
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
BigInteger nextval(String sequence) throws DataAccessException;
|
||||
|
||||
/**
|
||||
@ -12518,7 +12518,7 @@ public interface DSLContext extends Scope {
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
BigInteger nextval(Name sequence) throws DataAccessException;
|
||||
|
||||
/**
|
||||
@ -12528,7 +12528,7 @@ public interface DSLContext extends Scope {
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
<T extends Number> T nextval(Sequence<T> sequence) throws DataAccessException;
|
||||
|
||||
/**
|
||||
@ -12540,7 +12540,7 @@ public interface DSLContext extends Scope {
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
<T extends Number> List<T> nextvals(Sequence<T> sequence, int size) throws DataAccessException;
|
||||
|
||||
/**
|
||||
@ -12550,7 +12550,7 @@ public interface DSLContext extends Scope {
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
BigInteger currval(String sequence) throws DataAccessException;
|
||||
|
||||
/**
|
||||
@ -12560,7 +12560,7 @@ public interface DSLContext extends Scope {
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
BigInteger currval(Name sequence) throws DataAccessException;
|
||||
|
||||
/**
|
||||
@ -12570,7 +12570,7 @@ public interface DSLContext extends Scope {
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
<T extends Number> T currval(Sequence<T> sequence) throws DataAccessException;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -42,6 +42,7 @@ package org.jooq;
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
import static org.jooq.SQLDialect.DUCKDB;
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
@ -116,14 +117,14 @@ public interface Sequence<T extends Number> extends Qualified, Typed<T> {
|
||||
* An expression to get the current value of this sequence.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
Field<T> currval();
|
||||
|
||||
/**
|
||||
* An expression to increment the sequence and get the next value.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
Field<T> nextval();
|
||||
|
||||
/**
|
||||
@ -132,6 +133,6 @@ public interface Sequence<T extends Number> extends Qualified, Typed<T> {
|
||||
* This is done using {@link DSL#generateSeries(int, int)}.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
Select<Record1<T>> nextvals(int size);
|
||||
}
|
||||
@ -13622,7 +13622,7 @@ public class DSL {
|
||||
* </code></pre>
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
public static Sequence<BigInteger> sequence(Name name) {
|
||||
return sequence(name, BigInteger.class);
|
||||
}
|
||||
@ -13656,7 +13656,7 @@ public class DSL {
|
||||
* {@link SQLDataType})
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
public static <T extends Number> Sequence<T> sequence(Name name, Class<T> type) {
|
||||
return sequence(name, getDataType(type));
|
||||
}
|
||||
@ -13675,7 +13675,7 @@ public class DSL {
|
||||
* </code></pre>
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES, YUGABYTEDB })
|
||||
public static <T extends Number> Sequence<T> sequence(Name name, DataType<T> type) {
|
||||
return new SequenceImpl<>(
|
||||
name.unqualifiedName(),
|
||||
@ -15189,7 +15189,7 @@ public class DSL {
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "3.10")
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, POSTGRES, YUGABYTEDB })
|
||||
@PlainSQL
|
||||
public static Sequence<BigInteger> sequence(String sql) {
|
||||
return sequence(sql, BigInteger.class);
|
||||
@ -15220,7 +15220,7 @@ public class DSL {
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "3.10")
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, POSTGRES, YUGABYTEDB })
|
||||
@PlainSQL
|
||||
public static <T extends Number> Sequence<T> sequence(String sql, Class<T> type) {
|
||||
return sequence(sql, getDataType(type));
|
||||
@ -15243,7 +15243,7 @@ public class DSL {
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "3.10")
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CUBRID, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, POSTGRES, YUGABYTEDB })
|
||||
@PlainSQL
|
||||
public static <T extends Number> Sequence<T> sequence(String sql, DataType<T> type) {
|
||||
return new SequenceImpl<>(sql, null, type, true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user