diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java b/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java index 0519f2c153..88a1b8a1b9 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java @@ -64,6 +64,7 @@ import java.io.StringReader; import java.math.BigInteger; import java.sql.Connection; import java.sql.SQLException; +import java.util.AbstractMap.SimpleImmutableEntry; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -75,6 +76,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; import java.util.Properties; import java.util.Set; @@ -140,6 +142,8 @@ import org.jooq.tools.StringUtils; import org.jooq.tools.csv.CSVReader; import org.jooq.tools.jdbc.JDBCUtils; +import org.jetbrains.annotations.ApiStatus.Internal; + /** * A base implementation for all types of databases. * @@ -809,6 +813,17 @@ public abstract class AbstractDatabase implements Database { return null; } + @Internal + protected List> getInputCatalogsAndSchemata() { + List> result = new ArrayList<>(); + + for (String catalog : getInputCatalogs()) + for (String schema : getInputSchemata(catalog)) + result.add(new SimpleImmutableEntry<>(catalog, schema)); + + return result; + } + @Override public final List getInputCatalogs() { if (inputCatalogs == null) { diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/DuckDBDatabase.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/DuckDBDatabase.java index 2970672227..b10835469a 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/DuckDBDatabase.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/DuckDBDatabase.java @@ -38,68 +38,46 @@ package org.jooq.meta.duckdb; +import static java.util.stream.Collectors.toList; import static org.jooq.Records.mapping; -import static org.jooq.impl.DSL.decode; -import static org.jooq.impl.DSL.falseCondition; import static org.jooq.impl.DSL.field; import static org.jooq.impl.DSL.inline; -import static org.jooq.impl.DSL.name; -import static org.jooq.impl.DSL.noCondition; -import static org.jooq.impl.DSL.nvl; +import static org.jooq.impl.DSL.row; import static org.jooq.impl.DSL.select; -import static org.jooq.impl.DSL.when; import static org.jooq.impl.SQLDataType.BIGINT; +import static org.jooq.impl.SQLDataType.BOOLEAN; import static org.jooq.impl.SQLDataType.INTEGER; import static org.jooq.impl.SQLDataType.NUMERIC; import static org.jooq.impl.SQLDataType.VARCHAR; -import static org.jooq.meta.hsqldb.information_schema.Tables.CHECK_CONSTRAINTS; -import static org.jooq.meta.hsqldb.information_schema.Tables.COLUMNS; -import static org.jooq.meta.hsqldb.information_schema.Tables.DOMAIN_CONSTRAINTS; -import static org.jooq.meta.hsqldb.information_schema.Tables.ELEMENT_TYPES; -import static org.jooq.meta.hsqldb.information_schema.Tables.KEY_COLUMN_USAGE; -import static org.jooq.meta.hsqldb.information_schema.Tables.REFERENTIAL_CONSTRAINTS; -import static org.jooq.meta.hsqldb.information_schema.Tables.ROUTINES; -import static org.jooq.meta.hsqldb.information_schema.Tables.SCHEMATA; -import static org.jooq.meta.hsqldb.information_schema.Tables.SEQUENCES; -import static org.jooq.meta.hsqldb.information_schema.Tables.SYSTEM_INDEXINFO; -import static org.jooq.meta.hsqldb.information_schema.Tables.SYSTEM_TABLES; -import static org.jooq.meta.hsqldb.information_schema.Tables.TABLE_CONSTRAINTS; -import static org.jooq.meta.hsqldb.information_schema.Tables.VIEWS; +import static org.jooq.meta.duckdb.system.main.Tables.DUCKDB_CONSTRAINTS; +import static org.jooq.meta.duckdb.system.main.Tables.DUCKDB_DATABASES; +import static org.jooq.meta.duckdb.system.main.Tables.DUCKDB_SCHEMAS; +import static org.jooq.meta.duckdb.system.main.Tables.DUCKDB_TABLES; +import static org.jooq.meta.duckdb.system.main.Tables.DUCKDB_VIEWS; import java.math.BigDecimal; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; import org.jooq.DSLContext; -import org.jooq.Field; import org.jooq.Record; import org.jooq.Record12; import org.jooq.Record4; import org.jooq.Record6; -import org.jooq.Result; import org.jooq.ResultQuery; import org.jooq.SQLDialect; -import org.jooq.SortOrder; import org.jooq.TableOptions.TableType; import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; import org.jooq.meta.AbstractDatabase; -import org.jooq.meta.AbstractIndexDefinition; import org.jooq.meta.ArrayDefinition; import org.jooq.meta.CatalogDefinition; import org.jooq.meta.DataTypeDefinition; -import org.jooq.meta.DefaultCheckConstraintDefinition; import org.jooq.meta.DefaultDataTypeDefinition; -import org.jooq.meta.DefaultDomainDefinition; -import org.jooq.meta.DefaultIndexColumnDefinition; import org.jooq.meta.DefaultRelations; import org.jooq.meta.DefaultSequenceDefinition; import org.jooq.meta.DomainDefinition; import org.jooq.meta.EnumDefinition; -import org.jooq.meta.IndexColumnDefinition; import org.jooq.meta.IndexDefinition; import org.jooq.meta.PackageDefinition; import org.jooq.meta.ResultQueryDatabase; @@ -109,15 +87,6 @@ import org.jooq.meta.SequenceDefinition; import org.jooq.meta.TableDefinition; import org.jooq.meta.UDTDefinition; import org.jooq.meta.XMLSchemaCollectionDefinition; -import org.jooq.meta.hsqldb.HSQLDBRoutineDefinition; -import org.jooq.meta.hsqldb.HSQLDBTableDefinition; -import org.jooq.meta.hsqldb.HSQLDBTableValuedFunction; -import org.jooq.meta.hsqldb.information_schema.tables.CheckConstraints; -import org.jooq.meta.hsqldb.information_schema.tables.Columns; -import org.jooq.meta.hsqldb.information_schema.tables.DomainConstraints; -import org.jooq.meta.hsqldb.information_schema.tables.KeyColumnUsage; -import org.jooq.tools.JooqLogger; -import org.jooq.tools.StringUtils; /** * The DuckDB database @@ -140,28 +109,36 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab @Override protected void loadPrimaryKeys(DefaultRelations relations) throws SQLException { for (Record record : primaryKeys(getInputSchemata())) { - SchemaDefinition schema = getSchema(record.get(KEY_COLUMN_USAGE.TABLE_SCHEMA)); - String key = record.get(KEY_COLUMN_USAGE.CONSTRAINT_NAME); - String tableName = record.get(KEY_COLUMN_USAGE.TABLE_NAME); - String columnName = record.get(KEY_COLUMN_USAGE.COLUMN_NAME); + CatalogDefinition catalog = getCatalog(record.get(DUCKDB_CONSTRAINTS.DATABASE_NAME)); - TableDefinition table = getTable(schema, tableName); - if (table != null) - relations.addPrimaryKey(key, table, table.getColumn(columnName)); + if (catalog != null) { + SchemaDefinition schema = catalog.getSchema(record.get(DUCKDB_CONSTRAINTS.SCHEMA_NAME)); + String key = record.get(DUCKDB_CONSTRAINTS.CONSTRAINT_TEXT); + String tableName = record.get(DUCKDB_CONSTRAINTS.TABLE_NAME); + String columnName = record.get(DUCKDB_CONSTRAINTS.CONSTRAINT_COLUMN_NAMES, String.class); + + TableDefinition table = getTable(schema, tableName); + if (table != null) + relations.addPrimaryKey(key, table, table.getColumn(columnName)); + } } } @Override protected void loadUniqueKeys(DefaultRelations relations) throws SQLException { for (Record record : uniqueKeys(getInputSchemata())) { - SchemaDefinition schema = getSchema(record.get(KEY_COLUMN_USAGE.TABLE_SCHEMA)); - String key = record.get(KEY_COLUMN_USAGE.CONSTRAINT_NAME); - String tableName = record.get(KEY_COLUMN_USAGE.TABLE_NAME); - String columnName = record.get(KEY_COLUMN_USAGE.COLUMN_NAME); + CatalogDefinition catalog = getCatalog(record.get(DUCKDB_CONSTRAINTS.DATABASE_NAME)); - TableDefinition table = getTable(schema, tableName); - if (table != null) - relations.addUniqueKey(key, table, table.getColumn(columnName)); + if (catalog != null) { + SchemaDefinition schema = catalog.getSchema(record.get(DUCKDB_CONSTRAINTS.SCHEMA_NAME)); + String key = record.get(DUCKDB_CONSTRAINTS.CONSTRAINT_TEXT); + String tableName = record.get(DUCKDB_CONSTRAINTS.TABLE_NAME); + String columnName = record.get(DUCKDB_CONSTRAINTS.CONSTRAINT_COLUMN_NAMES, String.class); + + TableDefinition table = getTable(schema, tableName); + if (table != null) + relations.addUniqueKey(key, table, table.getColumn(columnName)); + } } } @@ -178,182 +155,100 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab private ResultQuery> keys(List schemas, String constraintType) { return create() .select( - KEY_COLUMN_USAGE.TABLE_CATALOG, - KEY_COLUMN_USAGE.TABLE_SCHEMA, - KEY_COLUMN_USAGE.TABLE_NAME, - KEY_COLUMN_USAGE.CONSTRAINT_NAME, - KEY_COLUMN_USAGE.COLUMN_NAME, - KEY_COLUMN_USAGE.ORDINAL_POSITION.coerce(INTEGER)) - .from(KEY_COLUMN_USAGE) - .where(KEY_COLUMN_USAGE.tableConstraints().CONSTRAINT_TYPE.eq(inline(constraintType))) - .and(KEY_COLUMN_USAGE.tableConstraints().TABLE_SCHEMA.in(schemas)) - .orderBy( - KEY_COLUMN_USAGE.TABLE_SCHEMA.asc(), - KEY_COLUMN_USAGE.TABLE_NAME.asc(), - KEY_COLUMN_USAGE.CONSTRAINT_NAME.asc(), - KEY_COLUMN_USAGE.ORDINAL_POSITION.asc()); + DUCKDB_CONSTRAINTS.DATABASE_NAME, + DUCKDB_CONSTRAINTS.SCHEMA_NAME, + DUCKDB_CONSTRAINTS.TABLE_NAME, + DUCKDB_CONSTRAINTS.DATABASE_NAME + .concat(inline("__")) + .concat(DUCKDB_CONSTRAINTS.SCHEMA_NAME) + .concat(inline("__")) + .concat(DUCKDB_CONSTRAINTS.TABLE_NAME) + .concat(inline("__")) + .concat(DUCKDB_CONSTRAINTS.CONSTRAINT_TEXT).as(DUCKDB_CONSTRAINTS.CONSTRAINT_TEXT), + field("unnest({0})", VARCHAR, DUCKDB_CONSTRAINTS.CONSTRAINT_COLUMN_NAMES).as(DUCKDB_CONSTRAINTS.CONSTRAINT_COLUMN_NAMES), + field("unnest({0})", INTEGER, DUCKDB_CONSTRAINTS.CONSTRAINT_COLUMN_INDEXES).as(DUCKDB_CONSTRAINTS.CONSTRAINT_COLUMN_INDEXES) + ) + .from("{0}()", DUCKDB_CONSTRAINTS) + .where(DUCKDB_CONSTRAINTS.CONSTRAINT_TYPE.eq(inline(constraintType))) + + // TODO: Query (catalog, schema), instead + .and(DUCKDB_CONSTRAINTS.SCHEMA_NAME.in(schemas)); } @Override protected void loadForeignKeys(DefaultRelations relations) throws SQLException { - KeyColumnUsage fkKcu = KEY_COLUMN_USAGE.as("fk_kcu"); - KeyColumnUsage pkKcu = KEY_COLUMN_USAGE.as("pk_kcu"); - - Result result = create() - .select( - REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_NAME, - REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_SCHEMA, - TABLE_CONSTRAINTS.TABLE_NAME, - fkKcu.CONSTRAINT_NAME, - fkKcu.TABLE_SCHEMA, - fkKcu.TABLE_NAME, - fkKcu.COLUMN_NAME, - pkKcu.COLUMN_NAME - ) - .from(REFERENTIAL_CONSTRAINTS) - .join(fkKcu) - .on(fkKcu.CONSTRAINT_SCHEMA.equal(REFERENTIAL_CONSTRAINTS.CONSTRAINT_SCHEMA)) - .and(fkKcu.CONSTRAINT_NAME.equal(REFERENTIAL_CONSTRAINTS.CONSTRAINT_NAME)) - .join(TABLE_CONSTRAINTS) - .on(TABLE_CONSTRAINTS.CONSTRAINT_SCHEMA.eq(REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_SCHEMA)) - .and(TABLE_CONSTRAINTS.CONSTRAINT_NAME.eq(REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_NAME)) - .join(pkKcu) - .on(pkKcu.CONSTRAINT_SCHEMA.eq(TABLE_CONSTRAINTS.CONSTRAINT_SCHEMA)) - .and(pkKcu.CONSTRAINT_NAME.eq(TABLE_CONSTRAINTS.CONSTRAINT_NAME)) - .and(pkKcu.ORDINAL_POSITION.eq(fkKcu.POSITION_IN_UNIQUE_CONSTRAINT)) - .where(fkKcu.TABLE_SCHEMA.in(getInputSchemata())) - .orderBy( - fkKcu.TABLE_SCHEMA.asc(), - fkKcu.TABLE_NAME.asc(), - fkKcu.CONSTRAINT_NAME.asc(), - fkKcu.ORDINAL_POSITION.asc()) - .fetch(); - - for (Record record : result) { - SchemaDefinition foreignKeySchema = getSchema(record.get(fkKcu.TABLE_SCHEMA)); - SchemaDefinition uniqueKeySchema = getSchema(record.get(REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_SCHEMA)); - - String foreignKey = record.get(fkKcu.CONSTRAINT_NAME); - String foreignKeyTableName = record.get(fkKcu.TABLE_NAME); - String foreignKeyColumn = record.get(fkKcu.COLUMN_NAME); - String uniqueKey = record.get(REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_NAME); - String uniqueKeyTableName = record.get(TABLE_CONSTRAINTS.TABLE_NAME); - String uniqueKeyColumn = record.get(pkKcu.COLUMN_NAME); - - TableDefinition foreignKeyTable = getTable(foreignKeySchema, foreignKeyTableName); - TableDefinition uniqueKeyTable = getTable(uniqueKeySchema, uniqueKeyTableName); - - if (foreignKeyTable != null && uniqueKeyTable != null) - relations.addForeignKey( - foreignKey, - foreignKeyTable, - foreignKeyTable.getColumn(foreignKeyColumn), - uniqueKey, - uniqueKeyTable, - uniqueKeyTable.getColumn(uniqueKeyColumn), - true - ); - } } @Override protected void loadCheckConstraints(DefaultRelations relations) throws SQLException { - CheckConstraints cc = CHECK_CONSTRAINTS.as("cc"); - Columns c = COLUMNS.as("c"); - - // [#2808] [#3019] Workaround for bad handling of JOIN .. USING - Field constraintName = field(name(cc.CONSTRAINT_NAME.getName()), String.class); - - for (Record record : create() - .select( - cc.tableConstraints().TABLE_SCHEMA, - cc.tableConstraints().TABLE_NAME, - constraintName, - cc.CHECK_CLAUSE - ) - .from(cc) - .where(cc.tableConstraints().TABLE_SCHEMA.in(getInputSchemata())) - .and(getIncludeSystemCheckConstraints() - ? noCondition() - : cc.tableConstraints().CONSTRAINT_NAME.notLike("SYS!_CT!_%", '!') - .or(cc.CHECK_CLAUSE.notIn( - - // TODO: Should we ever quote these? - select(c.TABLE_SCHEMA.concat(inline('.')) - .concat(c.TABLE_NAME).concat(inline('.')) - .concat(c.COLUMN_NAME).concat(inline(" IS NOT NULL"))) - .from(c) - .where(c.TABLE_SCHEMA.eq(cc.tableConstraints().TABLE_SCHEMA)) - .and(c.TABLE_NAME.eq(cc.tableConstraints().TABLE_NAME)) - ))) - ) { - - SchemaDefinition schema = getSchema(record.get(cc.tableConstraints().TABLE_SCHEMA)); - TableDefinition table = getTable(schema, record.get(cc.tableConstraints().TABLE_NAME)); - - if (table != null) { - relations.addCheckConstraint(table, new DefaultCheckConstraintDefinition( - schema, - table, - record.get(constraintName), - record.get(cc.CHECK_CLAUSE) - )); - } - } } @Override protected List getCatalogs0() throws SQLException { - List result = new ArrayList<>(); - result.add(new CatalogDefinition(this, "", "")); - return result; + return + create().select(DUCKDB_DATABASES.DATABASE_NAME) + .from("{0}()", DUCKDB_DATABASES) + .fetch(mapping(c -> new CatalogDefinition(this, c, ""))); } @Override protected List getSchemata0() throws SQLException { return - create().select(SCHEMATA.SCHEMA_NAME) - .from(SCHEMATA) - .fetch(mapping(s -> new SchemaDefinition(this, s, ""))); + create().select(DUCKDB_SCHEMAS.DATABASE_NAME, DUCKDB_SCHEMAS.SCHEMA_NAME) + .from("{0}()", DUCKDB_SCHEMAS) + .where(DUCKDB_SCHEMAS.DATABASE_NAME.in(getInputCatalogs())) + .fetch(mapping((c, s) -> new SchemaDefinition(this, s, "", getCatalog(c)))); } @Override public ResultQuery> sources(List schemas) { return create() .select( - VIEWS.TABLE_CATALOG, - VIEWS.TABLE_SCHEMA, - VIEWS.TABLE_NAME, - VIEWS.VIEW_DEFINITION) - .from(VIEWS) - .where(VIEWS.TABLE_SCHEMA.in(schemas)) - .orderBy( - VIEWS.TABLE_SCHEMA, - VIEWS.TABLE_NAME) - ; + DUCKDB_VIEWS.DATABASE_NAME, + DUCKDB_VIEWS.SCHEMA_NAME, + DUCKDB_VIEWS.VIEW_NAME, + DUCKDB_VIEWS.SQL) + .from("{0}()", DUCKDB_VIEWS) + .where(DUCKDB_VIEWS.SCHEMA_NAME.in(schemas)); } @Override public ResultQuery> sequences(List schemas) { return create() - .select( - inline(null, VARCHAR).as("catalog"), - SEQUENCES.SEQUENCE_SCHEMA, - SEQUENCES.SEQUENCE_NAME, - SEQUENCES.DATA_TYPE, - SEQUENCES.NUMERIC_PRECISION.coerce(INTEGER), - SEQUENCES.NUMERIC_SCALE.coerce(INTEGER), - SEQUENCES.START_WITH.coerce(BIGINT), - SEQUENCES.INCREMENT.coerce(BIGINT), - SEQUENCES.MINIMUM_VALUE.coerce(NUMERIC), - SEQUENCES.MAXIMUM_VALUE.coerce(NUMERIC), - decode(SEQUENCES.CYCLE_OPTION, inline("YES"), inline(true), inline(false)).as(SEQUENCES.CYCLE_OPTION), - inline(null, BIGINT).as("cache")) - .from(SEQUENCES) - .where(SEQUENCES.SEQUENCE_SCHEMA.in(schemas)) - .orderBy( - SEQUENCES.SEQUENCE_SCHEMA, - SEQUENCES.SEQUENCE_NAME); + .resultQuery( + """ + select + database_name, + schema_name, + sequence_name, + 'bigint' as data_type, + 0 as precision, + 0 as scale, + start_value, + increment_by, + min_value, + max_value, + cycle, + 0 as cache + from duckdb_sequences() + where sequence_name in ({0}) + """, + DSL.list(schemas.stream().map(DSL::val).collect(toList())) + ) + .coerce( + field("database_name", VARCHAR), + field("schema_name", VARCHAR), + field("sequence_name", VARCHAR), + field("data_type", VARCHAR), + field("precision", INTEGER), + field("scale", INTEGER), + field("start_value", BIGINT), + field("increment_by", BIGINT), + field("min_value", NUMERIC), + field("max_value", NUMERIC), + field("cycle", BOOLEAN), + field("cache", BIGINT) + ); } @Override @@ -361,16 +256,22 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab List result = new ArrayList<>(); for (Record record : sequences(getInputSchemata())) { - SchemaDefinition schema = getSchema(record.get(SEQUENCES.SEQUENCE_SCHEMA)); + CatalogDefinition catalog = getCatalog(record.get("database_name", String.class)); - DataTypeDefinition type = new DefaultDataTypeDefinition( - this, - schema, - record.get(SEQUENCES.DATA_TYPE) - ); + if (catalog != null) { + SchemaDefinition schema = getSchema(record.get("schema_name", String.class)); - result.add(new DefaultSequenceDefinition( - schema, record.get(SEQUENCES.SEQUENCE_NAME), type)); + if (schema != null) { + DataTypeDefinition type = new DefaultDataTypeDefinition( + this, + schema, + "BIGINT" + ); + + result.add(new DefaultSequenceDefinition( + schema, record.get("sequence_name", String.class), type)); + } + } } return result; @@ -381,52 +282,35 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab List result = new ArrayList<>(); for (Record record : create() - .select( - SYSTEM_TABLES.TABLE_SCHEM, - SYSTEM_TABLES.TABLE_NAME, - inline("").as(ROUTINES.SPECIFIC_NAME), - SYSTEM_TABLES.REMARKS, - when(SYSTEM_TABLES.TABLE_TYPE.eq(inline("VIEW")), inline(TableType.VIEW.name())) - .else_(inline(TableType.TABLE.name())).trim().as("table_type"), - when(VIEWS.VIEW_DEFINITION.lower().like(inline("create%")), VIEWS.VIEW_DEFINITION) - .else_(inline("create view \"").concat(SYSTEM_TABLES.TABLE_NAME).concat("\" as ").concat(VIEWS.VIEW_DEFINITION)).as(VIEWS.VIEW_DEFINITION) + .select( + DUCKDB_TABLES.DATABASE_NAME, + DUCKDB_TABLES.SCHEMA_NAME, + DUCKDB_TABLES.TABLE_NAME, + inline(TableType.TABLE.name()).as("table_type") + ) + .from("{0}()", DUCKDB_TABLES) + .where(row(DUCKDB_TABLES.DATABASE_NAME, DUCKDB_TABLES.SCHEMA_NAME).in( + getInputCatalogsAndSchemata().stream().map(e -> row(e.getKey(), e.getValue())).collect(toList()) + )) + .unionAll( + select( + DUCKDB_VIEWS.DATABASE_NAME, + DUCKDB_VIEWS.SCHEMA_NAME, + DUCKDB_VIEWS.VIEW_NAME, + inline(TableType.VIEW.name()).as("table_type") ) - .from(SYSTEM_TABLES) - .leftJoin(VIEWS) - .on(SYSTEM_TABLES.TABLE_SCHEM.eq(VIEWS.TABLE_SCHEMA)) - .and(SYSTEM_TABLES.TABLE_NAME.eq(VIEWS.TABLE_NAME)) - .where(SYSTEM_TABLES.TABLE_SCHEM.in(getInputSchemata())) - .unionAll(tableValuedFunctions() - ? select( - ROUTINES.ROUTINE_SCHEMA, - ROUTINES.ROUTINE_NAME, - ROUTINES.SPECIFIC_NAME, - inline(""), - inline(TableType.FUNCTION.name()), - ROUTINES.ROUTINE_DEFINITION) - .from(ROUTINES) - .where(ROUTINES.ROUTINE_SCHEMA.in(getInputSchemata())) - .and(ROUTINES.ROUTINE_TYPE.eq(inline("FUNCTION"))) - .and(ROUTINES.DATA_TYPE.startsWith(inline("ROW("))) - : select(inline(""), inline(""), inline(""), inline(""), inline(TableType.FUNCTION.name()), inline("")) - .where(falseCondition()) - ) - .orderBy( - SYSTEM_TABLES.TABLE_SCHEM, - SYSTEM_TABLES.TABLE_NAME).fetch()) { - - SchemaDefinition schema = getSchema(record.get(SYSTEM_TABLES.TABLE_SCHEM)); - String name = record.get(SYSTEM_TABLES.TABLE_NAME); - String specificName = record.get(ROUTINES.SPECIFIC_NAME); - String comment = record.get(SYSTEM_TABLES.REMARKS); + .from("{0}()", DUCKDB_VIEWS) + .where(row(DUCKDB_VIEWS.DATABASE_NAME, DUCKDB_VIEWS.SCHEMA_NAME).in( + getInputCatalogsAndSchemata().stream().map(e -> row(e.getKey(), e.getValue())).collect(toList()) + )) + ) + .orderBy(1, 2, 3) + ) { + CatalogDefinition catalog = getCatalog(record.get(DUCKDB_TABLES.DATABASE_NAME)); + SchemaDefinition schema = catalog.getSchema(record.get(DUCKDB_TABLES.SCHEMA_NAME)); + String name = record.get(DUCKDB_TABLES.TABLE_NAME); TableType tableType = record.get("table_type", TableType.class); - String source = record.get(VIEWS.VIEW_DEFINITION); - - - if (tableType == TableType.FUNCTION) - result.add(new HSQLDBTableValuedFunction(schema, name, specificName, comment, source)); - else - result.add(new HSQLDBTableDefinition(schema, name, comment, tableType, source)); + result.add(new DuckDBTableDefinition(schema, name, "", tableType, null)); } return result; @@ -441,48 +325,6 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab @Override protected List getDomains0() throws SQLException { List result = new ArrayList<>(); - - DomainConstraints dc = DOMAIN_CONSTRAINTS.as("dc"); - - for (Record record : create() - .select( - dc.domains().DOMAIN_SCHEMA, - dc.domains().DOMAIN_NAME, - dc.domains().DATA_TYPE, - dc.domains().CHARACTER_MAXIMUM_LENGTH, - dc.domains().NUMERIC_PRECISION, - dc.domains().NUMERIC_SCALE, - dc.domains().DOMAIN_DEFAULT, - dc.checkConstraints().CHECK_CLAUSE) - .from(dc) - .where(dc.domains().DOMAIN_SCHEMA.in(getInputSchemata())) - .orderBy(dc.domains().DOMAIN_SCHEMA, dc.domains().DOMAIN_NAME) - ) { - SchemaDefinition schema = getSchema(record.get(dc.domains().DOMAIN_SCHEMA)); - - DataTypeDefinition baseType = new DefaultDataTypeDefinition( - this, - schema, - record.get(dc.domains().DATA_TYPE), - record.get(dc.domains().CHARACTER_MAXIMUM_LENGTH), - record.get(dc.domains().NUMERIC_PRECISION), - record.get(dc.domains().NUMERIC_SCALE), - true, - record.get(dc.domains().DOMAIN_DEFAULT) - ); - - DefaultDomainDefinition domain = new DefaultDomainDefinition( - schema, - record.get(dc.domains().DOMAIN_NAME), - baseType - ); - - if (!StringUtils.isBlank(record.get(dc.checkConstraints().CHECK_CLAUSE))) - domain.addCheckClause(record.get(dc.checkConstraints().CHECK_CLAUSE)); - - result.add(domain); - } - return result; } @@ -507,48 +349,6 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab @Override protected List getRoutines0() throws SQLException { List result = new ArrayList<>(); - - for (Record record : create() - .select( - ROUTINES.ROUTINE_SCHEMA, - ROUTINES.ROUTINE_NAME, - ROUTINES.SPECIFIC_NAME, - nvl(ELEMENT_TYPES.COLLECTION_TYPE_IDENTIFIER, ROUTINES.DATA_TYPE).as("datatype"), - ROUTINES.NUMERIC_PRECISION, - ROUTINES.NUMERIC_SCALE, - ROUTINES.ROUTINE_DEFINITION.likeRegex(".*(?i:(\\w+\\s+)+aggregate\\s+function).*").as("aggregate")) - .from(ROUTINES) - .leftOuterJoin(ELEMENT_TYPES) - .on(ROUTINES.ROUTINE_SCHEMA.equal(ELEMENT_TYPES.OBJECT_SCHEMA)) - .and(ROUTINES.ROUTINE_NAME.equal(ELEMENT_TYPES.OBJECT_NAME)) - .and(ROUTINES.DTD_IDENTIFIER.equal(ELEMENT_TYPES.COLLECTION_TYPE_IDENTIFIER)) - .where(ROUTINES.ROUTINE_SCHEMA.in(getInputSchemata())) - .and(tableValuedFunctions() - ? ROUTINES.DATA_TYPE.isNull().or(ROUTINES.DATA_TYPE.notLike(inline("ROW(%"))) - : noCondition()) - .orderBy( - ROUTINES.ROUTINE_SCHEMA, - ROUTINES.ROUTINE_NAME) - .fetch()) { - - String datatype = record.get("datatype", String.class); - - // [#3285] We currently do not recognise HSQLDB table-valued functions as such. - if (datatype != null && datatype.toUpperCase().startsWith("ROW")) { - JooqLogger.getLogger(getClass()).info("A row : " +datatype); - datatype = "ROW"; - } - - result.add(new HSQLDBRoutineDefinition( - getSchema(record.get(ROUTINES.ROUTINE_SCHEMA)), - record.get(ROUTINES.ROUTINE_NAME), - record.get(ROUTINES.SPECIFIC_NAME), - datatype, - record.get(ROUTINES.NUMERIC_PRECISION), - record.get(ROUTINES.NUMERIC_SCALE), - record.get("aggregate", boolean.class))); - } - return result; } diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/DuckDBTableDefinition.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/DuckDBTableDefinition.java new file mode 100644 index 0000000000..47cddfc535 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/DuckDBTableDefinition.java @@ -0,0 +1,114 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: https://www.jooq.org/legal/licensing + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +package org.jooq.meta.duckdb; + +import static org.jooq.meta.duckdb.system.main.Tables.DUCKDB_COLUMNS; +import static org.jooq.meta.hsqldb.information_schema.Tables.COLUMNS; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.jooq.Record; +import org.jooq.TableOptions.TableType; +import org.jooq.meta.AbstractTableDefinition; +import org.jooq.meta.ColumnDefinition; +import org.jooq.meta.DataTypeDefinition; +import org.jooq.meta.DefaultColumnDefinition; +import org.jooq.meta.DefaultDataTypeDefinition; +import org.jooq.meta.SchemaDefinition; + +/** + * @author Lukas Eder + */ +public class DuckDBTableDefinition extends AbstractTableDefinition { + + public DuckDBTableDefinition(SchemaDefinition schema, String name, String comment) { + super(schema, name, comment); + } + + public DuckDBTableDefinition(SchemaDefinition schema, String name, String comment, TableType tableType, String source) { + super(schema, name, comment, tableType, source); + } + + @Override + public List getElements0() throws SQLException { + List result = new ArrayList<>(); + + for (Record record : create() + .select( + DUCKDB_COLUMNS.COLUMN_NAME, + DUCKDB_COLUMNS.COLUMN_INDEX, + DUCKDB_COLUMNS.DATA_TYPE, + DUCKDB_COLUMNS.CHARACTER_MAXIMUM_LENGTH, + DUCKDB_COLUMNS.NUMERIC_PRECISION, + DUCKDB_COLUMNS.NUMERIC_SCALE, + DUCKDB_COLUMNS.IS_NULLABLE, + DUCKDB_COLUMNS.COLUMN_DEFAULT + ) + .from("{0}()", DUCKDB_COLUMNS) + .where(DUCKDB_COLUMNS.DATABASE_NAME.eq(getCatalog().getInputName())) + .and(DUCKDB_COLUMNS.SCHEMA_NAME.eq(getSchema().getInputName())) + .and(DUCKDB_COLUMNS.TABLE_NAME.eq(getInputName())) + .orderBy(DUCKDB_COLUMNS.COLUMN_INDEX) + ) { + DataTypeDefinition type = new DefaultDataTypeDefinition( + getDatabase(), + getSchema(), + record.get(DUCKDB_COLUMNS.DATA_TYPE), + record.get(DUCKDB_COLUMNS.CHARACTER_MAXIMUM_LENGTH), + record.get(DUCKDB_COLUMNS.NUMERIC_PRECISION), + record.get(DUCKDB_COLUMNS.NUMERIC_SCALE), + record.get(DUCKDB_COLUMNS.IS_NULLABLE), + record.get(DUCKDB_COLUMNS.COLUMN_DEFAULT) + ); + + result.add(new DefaultColumnDefinition( + this, + record.get(DUCKDB_COLUMNS.COLUMN_NAME), + record.get(DUCKDB_COLUMNS.COLUMN_INDEX), + type, + false, + null + )); + } + + return result; + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/System.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/System.java new file mode 100644 index 0000000000..b1d22199b8 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/System.java @@ -0,0 +1,62 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Constants; +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; +import org.jooq.meta.duckdb.system.information_schema.InformationSchema; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class System extends CatalogImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system + */ + public static final System SYSTEM = new System(); + + /** + * The schema system.information_schema. + */ + public final InformationSchema INFORMATION_SCHEMA = InformationSchema.INFORMATION_SCHEMA; + + /** + * The schema system.main. + */ + public final Main MAIN = Main.MAIN; + + /** + * No further instances allowed + */ + private System() { + super("system"); + } + + @Override + public final List getSchemas() { + return Arrays.asList( + InformationSchema.INFORMATION_SCHEMA, + Main.MAIN + ); + } + + /** + * A reference to the 3.19 minor release of the code generator. If this + * doesn't compile, it's because the runtime library uses an older minor + * release, namely: 3.19. You can turn off the generation of this reference + * by specifying /configuration/generator/generate/jooqVersionReference + */ + private static final String REQUIRE_RUNTIME_JOOQ_VERSION = Constants.VERSION_3_19; +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/InformationSchema.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/InformationSchema.java new file mode 100644 index 0000000000..2a3bc95793 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/InformationSchema.java @@ -0,0 +1,68 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.information_schema; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Catalog; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; +import org.jooq.meta.duckdb.system.System; +import org.jooq.meta.duckdb.system.information_schema.tables.Columns; +import org.jooq.meta.duckdb.system.information_schema.tables.Schemata; +import org.jooq.meta.duckdb.system.information_schema.tables.Tables; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class InformationSchema extends SchemaImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.information_schema + */ + public static final InformationSchema INFORMATION_SCHEMA = new InformationSchema(); + + /** + * The table system.information_schema.columns. + */ + public final Columns COLUMNS = Columns.COLUMNS; + + /** + * The table system.information_schema.schemata. + */ + public final Schemata SCHEMATA = Schemata.SCHEMATA; + + /** + * The table system.information_schema.tables. + */ + public final Tables TABLES = Tables.TABLES; + + /** + * No further instances allowed + */ + private InformationSchema() { + super("information_schema", null); + } + + + @Override + public Catalog getCatalog() { + return System.SYSTEM; + } + + @Override + public final List> getTables() { + return Arrays.asList( + Columns.COLUMNS, + Schemata.SCHEMATA, + Tables.TABLES + ); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/Keys.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/Keys.java new file mode 100644 index 0000000000..371307b339 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/Keys.java @@ -0,0 +1,39 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.information_schema; + + +import org.jooq.ForeignKey; +import org.jooq.Record; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.Internal; +import org.jooq.meta.duckdb.system.information_schema.tables.Columns; +import org.jooq.meta.duckdb.system.information_schema.tables.Schemata; +import org.jooq.meta.duckdb.system.information_schema.tables.Tables; + + +/** + * A class modelling foreign key relationships and constraints of tables in + * information_schema. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Keys { + + // ------------------------------------------------------------------------- + // UNIQUE and PRIMARY KEY definitions + // ------------------------------------------------------------------------- + + public static final UniqueKey SYNTHETIC_PK_SCHEMATA = Internal.createUniqueKey(Schemata.SCHEMATA, DSL.name("SYNTHETIC_PK_schemata"), new TableField[] { Schemata.SCHEMATA.CATALOG_NAME, Schemata.SCHEMATA.SCHEMA_NAME }, true); + public static final UniqueKey SYNTHETIC_PK_TABLES = Internal.createUniqueKey(Tables.TABLES, DSL.name("SYNTHETIC_PK_tables"), new TableField[] { Tables.TABLES.TABLE_CATALOG, Tables.TABLES.TABLE_SCHEMA, Tables.TABLES.TABLE_NAME }, true); + + // ------------------------------------------------------------------------- + // FOREIGN KEY definitions + // ------------------------------------------------------------------------- + + public static final ForeignKey SYNTHETIC_FK_COLUMNS__SYNTHETIC_PK_SCHEMATA = Internal.createForeignKey(Columns.COLUMNS, DSL.name("SYNTHETIC_FK_columns__SYNTHETIC_PK_schemata"), new TableField[] { Columns.COLUMNS.TABLE_CATALOG, Columns.COLUMNS.TABLE_SCHEMA }, Keys.SYNTHETIC_PK_SCHEMATA, new TableField[] { Schemata.SCHEMATA.CATALOG_NAME, Schemata.SCHEMATA.SCHEMA_NAME }, true); + public static final ForeignKey SYNTHETIC_FK_COLUMNS__SYNTHETIC_PK_TABLES = Internal.createForeignKey(Columns.COLUMNS, DSL.name("SYNTHETIC_FK_columns__SYNTHETIC_PK_tables"), new TableField[] { Columns.COLUMNS.TABLE_CATALOG, Columns.COLUMNS.TABLE_SCHEMA, Columns.COLUMNS.TABLE_NAME }, Keys.SYNTHETIC_PK_TABLES, new TableField[] { Tables.TABLES.TABLE_CATALOG, Tables.TABLES.TABLE_SCHEMA, Tables.TABLES.TABLE_NAME }, true); + public static final ForeignKey SYNTHETIC_FK_TABLES__SYNTHETIC_PK_SCHEMATA = Internal.createForeignKey(Tables.TABLES, DSL.name("SYNTHETIC_FK_tables__SYNTHETIC_PK_schemata"), new TableField[] { Tables.TABLES.TABLE_CATALOG, Tables.TABLES.TABLE_SCHEMA }, Keys.SYNTHETIC_PK_SCHEMATA, new TableField[] { Schemata.SCHEMATA.CATALOG_NAME, Schemata.SCHEMATA.SCHEMA_NAME }, true); +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/Tables.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/Tables.java new file mode 100644 index 0000000000..0ff7b12c11 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/Tables.java @@ -0,0 +1,31 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.information_schema; + + +import org.jooq.meta.duckdb.system.information_schema.tables.Columns; +import org.jooq.meta.duckdb.system.information_schema.tables.Schemata; + + +/** + * Convenience access to all tables in information_schema. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Tables { + + /** + * The table system.information_schema.columns. + */ + public static final Columns COLUMNS = Columns.COLUMNS; + + /** + * The table system.information_schema.schemata. + */ + public static final Schemata SCHEMATA = Schemata.SCHEMATA; + + /** + * The table system.information_schema.tables. + */ + public static final org.jooq.meta.duckdb.system.information_schema.tables.Tables TABLES = org.jooq.meta.duckdb.system.information_schema.tables.Tables.TABLES; +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Columns.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Columns.java new file mode 100644 index 0000000000..3e456598e7 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Columns.java @@ -0,0 +1,570 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.information_schema.tables; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.information_schema.InformationSchema; +import org.jooq.meta.duckdb.system.information_schema.Keys; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Columns extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.information_schema.columns + */ + public static final Columns COLUMNS = new Columns(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.information_schema.columns.table_catalog. + */ + public final TableField TABLE_CATALOG = createField(DSL.name("table_catalog"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.columns.table_schema. + */ + public final TableField TABLE_SCHEMA = createField(DSL.name("table_schema"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.columns.table_name. + */ + public final TableField TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.columns.column_name. + */ + public final TableField COLUMN_NAME = createField(DSL.name("column_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column + * system.information_schema.columns.ordinal_position. + */ + public final TableField ORDINAL_POSITION = createField(DSL.name("ordinal_position"), SQLDataType.INTEGER, this, ""); + + /** + * The column system.information_schema.columns.column_default. + */ + public final TableField COLUMN_DEFAULT = createField(DSL.name("column_default"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.columns.is_nullable. + */ + public final TableField IS_NULLABLE = createField(DSL.name("is_nullable"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.columns.data_type. + */ + public final TableField DATA_TYPE = createField(DSL.name("data_type"), SQLDataType.VARCHAR, this, ""); + + /** + * The column + * system.information_schema.columns.character_maximum_length. + */ + public final TableField CHARACTER_MAXIMUM_LENGTH = createField(DSL.name("character_maximum_length"), SQLDataType.INTEGER, this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField CHARACTER_OCTET_LENGTH = createField(DSL.name("character_octet_length"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * The column + * system.information_schema.columns.numeric_precision. + */ + public final TableField NUMERIC_PRECISION = createField(DSL.name("numeric_precision"), SQLDataType.INTEGER, this, ""); + + /** + * The column + * system.information_schema.columns.numeric_precision_radix. + */ + public final TableField NUMERIC_PRECISION_RADIX = createField(DSL.name("numeric_precision_radix"), SQLDataType.INTEGER, this, ""); + + /** + * The column system.information_schema.columns.numeric_scale. + */ + public final TableField NUMERIC_SCALE = createField(DSL.name("numeric_scale"), SQLDataType.INTEGER, this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DATETIME_PRECISION = createField(DSL.name("datetime_precision"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField INTERVAL_TYPE = createField(DSL.name("interval_type"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField INTERVAL_PRECISION = createField(DSL.name("interval_precision"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField CHARACTER_SET_CATALOG = createField(DSL.name("character_set_catalog"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField CHARACTER_SET_SCHEMA = createField(DSL.name("character_set_schema"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField CHARACTER_SET_NAME = createField(DSL.name("character_set_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField COLLATION_CATALOG = createField(DSL.name("collation_catalog"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField COLLATION_SCHEMA = createField(DSL.name("collation_schema"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField COLLATION_NAME = createField(DSL.name("collation_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DOMAIN_CATALOG = createField(DSL.name("domain_catalog"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DOMAIN_SCHEMA = createField(DSL.name("domain_schema"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DOMAIN_NAME = createField(DSL.name("domain_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField UDT_CATALOG = createField(DSL.name("udt_catalog"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField UDT_SCHEMA = createField(DSL.name("udt_schema"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField UDT_NAME = createField(DSL.name("udt_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField SCOPE_CATALOG = createField(DSL.name("scope_catalog"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField SCOPE_SCHEMA = createField(DSL.name("scope_schema"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField SCOPE_NAME = createField(DSL.name("scope_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField MAXIMUM_CARDINALITY = createField(DSL.name("maximum_cardinality"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DTD_IDENTIFIER = createField(DSL.name("dtd_identifier"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IS_SELF_REFERENCING = createField(DSL.name("is_self_referencing"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IS_IDENTITY = createField(DSL.name("is_identity"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IDENTITY_GENERATION = createField(DSL.name("identity_generation"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IDENTITY_START = createField(DSL.name("identity_start"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IDENTITY_INCREMENT = createField(DSL.name("identity_increment"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IDENTITY_MAXIMUM = createField(DSL.name("identity_maximum"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IDENTITY_MINIMUM = createField(DSL.name("identity_minimum"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IDENTITY_CYCLE = createField(DSL.name("identity_cycle"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IS_GENERATED = createField(DSL.name("is_generated"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField GENERATION_EXPRESSION = createField(DSL.name("generation_expression"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField IS_UPDATABLE = createField(DSL.name("is_updatable"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + private Columns(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private Columns(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.information_schema.columns table + * reference + */ + public Columns(String alias) { + this(DSL.name(alias), COLUMNS); + } + + /** + * Create an aliased system.information_schema.columns table + * reference + */ + public Columns(Name alias) { + this(alias, COLUMNS); + } + + /** + * Create a system.information_schema.columns table reference + */ + public Columns() { + this(DSL.name("columns"), null); + } + + public Columns(Table child, ForeignKey key) { + super(child, key, COLUMNS); + } + + @Override + public Schema getSchema() { + return aliased() ? null : InformationSchema.INFORMATION_SCHEMA; + } + + @Override + public List> getReferences() { + return Arrays.asList(Keys.SYNTHETIC_FK_COLUMNS__SYNTHETIC_PK_TABLES, Keys.SYNTHETIC_FK_COLUMNS__SYNTHETIC_PK_SCHEMATA); + } + + private transient Tables _tables; + private transient Schemata _schemata; + + /** + * Get the implicit join path to the + * system.information_schema.tables table. + */ + public Tables tables() { + if (_tables == null) + _tables = new Tables(this, Keys.SYNTHETIC_FK_COLUMNS__SYNTHETIC_PK_TABLES); + + return _tables; + } + + /** + * Get the implicit join path to the + * system.information_schema.schemata table. + */ + public Schemata schemata() { + if (_schemata == null) + _schemata = new Schemata(this, Keys.SYNTHETIC_FK_COLUMNS__SYNTHETIC_PK_SCHEMATA); + + return _schemata; + } + + @Override + public Columns as(String alias) { + return new Columns(DSL.name(alias), this); + } + + @Override + public Columns as(Name alias) { + return new Columns(alias, this); + } + + @Override + public Columns as(Table alias) { + return new Columns(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public Columns rename(String name) { + return new Columns(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Columns rename(Name name) { + return new Columns(name, null); + } + + /** + * Rename this table + */ + @Override + public Columns rename(Table name) { + return new Columns(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Schemata.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Schemata.java new file mode 100644 index 0000000000..438ffb924a --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Schemata.java @@ -0,0 +1,180 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.information_schema.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.information_schema.InformationSchema; +import org.jooq.meta.duckdb.system.information_schema.Keys; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Schemata extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.information_schema.schemata + */ + public static final Schemata SCHEMATA = new Schemata(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.information_schema.schemata.catalog_name. + */ + public final TableField CATALOG_NAME = createField(DSL.name("catalog_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.schemata.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.schemata.schema_owner. + */ + public final TableField SCHEMA_OWNER = createField(DSL.name("schema_owner"), SQLDataType.VARCHAR, this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DEFAULT_CHARACTER_SET_CATALOG = createField(DSL.name("default_character_set_catalog"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DEFAULT_CHARACTER_SET_SCHEMA = createField(DSL.name("default_character_set_schema"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField DEFAULT_CHARACTER_SET_NAME = createField(DSL.name("default_character_set_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * The column system.information_schema.schemata.sql_path. + */ + public final TableField SQL_PATH = createField(DSL.name("sql_path"), SQLDataType.VARCHAR, this, ""); + + private Schemata(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private Schemata(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.information_schema.schemata table + * reference + */ + public Schemata(String alias) { + this(DSL.name(alias), SCHEMATA); + } + + /** + * Create an aliased system.information_schema.schemata table + * reference + */ + public Schemata(Name alias) { + this(alias, SCHEMATA); + } + + /** + * Create a system.information_schema.schemata table reference + */ + public Schemata() { + this(DSL.name("schemata"), null); + } + + public Schemata(Table child, ForeignKey key) { + super(child, key, SCHEMATA); + } + + @Override + public Schema getSchema() { + return aliased() ? null : InformationSchema.INFORMATION_SCHEMA; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.SYNTHETIC_PK_SCHEMATA; + } + + @Override + public Schemata as(String alias) { + return new Schemata(DSL.name(alias), this); + } + + @Override + public Schemata as(Name alias) { + return new Schemata(alias, this); + } + + @Override + public Schemata as(Table alias) { + return new Schemata(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public Schemata rename(String name) { + return new Schemata(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Schemata rename(Name name) { + return new Schemata(name, null); + } + + /** + * Rename this table + */ + @Override + public Schemata rename(Table name) { + return new Schemata(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Tables.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Tables.java new file mode 100644 index 0000000000..966436a131 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/information_schema/tables/Tables.java @@ -0,0 +1,239 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.information_schema.tables; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.information_schema.InformationSchema; +import org.jooq.meta.duckdb.system.information_schema.Keys; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Tables extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.information_schema.tables + */ + public static final Tables TABLES = new Tables(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.information_schema.tables.table_catalog. + */ + public final TableField TABLE_CATALOG = createField(DSL.name("table_catalog"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.tables.table_schema. + */ + public final TableField TABLE_SCHEMA = createField(DSL.name("table_schema"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.tables.table_name. + */ + public final TableField TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.tables.table_type. + */ + public final TableField TABLE_TYPE = createField(DSL.name("table_type"), SQLDataType.VARCHAR, this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField SELF_REFERENCING_COLUMN_NAME = createField(DSL.name("self_referencing_column_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField REFERENCE_GENERATION = createField(DSL.name("reference_generation"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField USER_DEFINED_TYPE_CATALOG = createField(DSL.name("user_defined_type_catalog"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField USER_DEFINED_TYPE_SCHEMA = createField(DSL.name("user_defined_type_schema"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField USER_DEFINED_TYPE_NAME = createField(DSL.name("user_defined_type_name"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"NULL\""), this, ""); + + /** + * The column + * system.information_schema.tables.is_insertable_into. + */ + public final TableField IS_INSERTABLE_INTO = createField(DSL.name("is_insertable_into"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.tables.is_typed. + */ + public final TableField IS_TYPED = createField(DSL.name("is_typed"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.information_schema.tables.commit_action. + */ + public final TableField COMMIT_ACTION = createField(DSL.name("commit_action"), SQLDataType.VARCHAR, this, ""); + + private Tables(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private Tables(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.information_schema.tables table + * reference + */ + public Tables(String alias) { + this(DSL.name(alias), TABLES); + } + + /** + * Create an aliased system.information_schema.tables table + * reference + */ + public Tables(Name alias) { + this(alias, TABLES); + } + + /** + * Create a system.information_schema.tables table reference + */ + public Tables() { + this(DSL.name("tables"), null); + } + + public Tables(Table child, ForeignKey key) { + super(child, key, TABLES); + } + + @Override + public Schema getSchema() { + return aliased() ? null : InformationSchema.INFORMATION_SCHEMA; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.SYNTHETIC_PK_TABLES; + } + + @Override + public List> getReferences() { + return Arrays.asList(Keys.SYNTHETIC_FK_TABLES__SYNTHETIC_PK_SCHEMATA); + } + + private transient Schemata _schemata; + + /** + * Get the implicit join path to the + * system.information_schema.schemata table. + */ + public Schemata schemata() { + if (_schemata == null) + _schemata = new Schemata(this, Keys.SYNTHETIC_FK_TABLES__SYNTHETIC_PK_SCHEMATA); + + return _schemata; + } + + @Override + public Tables as(String alias) { + return new Tables(DSL.name(alias), this); + } + + @Override + public Tables as(Name alias) { + return new Tables(alias, this); + } + + @Override + public Tables as(Table alias) { + return new Tables(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public Tables rename(String name) { + return new Tables(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Tables rename(Name name) { + return new Tables(name, null); + } + + /** + * Rename this table + */ + @Override + public Tables rename(Table name) { + return new Tables(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/Main.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/Main.java new file mode 100644 index 0000000000..04d11b8fc4 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/Main.java @@ -0,0 +1,103 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Catalog; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; +import org.jooq.meta.duckdb.system.System; +import org.jooq.meta.duckdb.system.main.tables.DuckdbColumns; +import org.jooq.meta.duckdb.system.main.tables.DuckdbConstraints; +import org.jooq.meta.duckdb.system.main.tables.DuckdbDatabases; +import org.jooq.meta.duckdb.system.main.tables.DuckdbIndexes; +import org.jooq.meta.duckdb.system.main.tables.DuckdbSchemas; +import org.jooq.meta.duckdb.system.main.tables.DuckdbTables; +import org.jooq.meta.duckdb.system.main.tables.DuckdbTypes; +import org.jooq.meta.duckdb.system.main.tables.DuckdbViews; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Main extends SchemaImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main + */ + public static final Main MAIN = new Main(); + + /** + * The table system.main.duckdb_columns. + */ + public final DuckdbColumns DUCKDB_COLUMNS = DuckdbColumns.DUCKDB_COLUMNS; + + /** + * The table system.main.duckdb_constraints. + */ + public final DuckdbConstraints DUCKDB_CONSTRAINTS = DuckdbConstraints.DUCKDB_CONSTRAINTS; + + /** + * The table system.main.duckdb_databases. + */ + public final DuckdbDatabases DUCKDB_DATABASES = DuckdbDatabases.DUCKDB_DATABASES; + + /** + * The table system.main.duckdb_indexes. + */ + public final DuckdbIndexes DUCKDB_INDEXES = DuckdbIndexes.DUCKDB_INDEXES; + + /** + * The table system.main.duckdb_schemas. + */ + public final DuckdbSchemas DUCKDB_SCHEMAS = DuckdbSchemas.DUCKDB_SCHEMAS; + + /** + * The table system.main.duckdb_tables. + */ + public final DuckdbTables DUCKDB_TABLES = DuckdbTables.DUCKDB_TABLES; + + /** + * The table system.main.duckdb_types. + */ + public final DuckdbTypes DUCKDB_TYPES = DuckdbTypes.DUCKDB_TYPES; + + /** + * The table system.main.duckdb_views. + */ + public final DuckdbViews DUCKDB_VIEWS = DuckdbViews.DUCKDB_VIEWS; + + /** + * No further instances allowed + */ + private Main() { + super("main", null); + } + + + @Override + public Catalog getCatalog() { + return System.SYSTEM; + } + + @Override + public final List> getTables() { + return Arrays.asList( + DuckdbColumns.DUCKDB_COLUMNS, + DuckdbConstraints.DUCKDB_CONSTRAINTS, + DuckdbDatabases.DUCKDB_DATABASES, + DuckdbIndexes.DUCKDB_INDEXES, + DuckdbSchemas.DUCKDB_SCHEMAS, + DuckdbTables.DUCKDB_TABLES, + DuckdbTypes.DUCKDB_TYPES, + DuckdbViews.DUCKDB_VIEWS + ); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/Tables.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/Tables.java new file mode 100644 index 0000000000..fae0b2c8f5 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/Tables.java @@ -0,0 +1,62 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main; + + +import org.jooq.meta.duckdb.system.main.tables.DuckdbColumns; +import org.jooq.meta.duckdb.system.main.tables.DuckdbConstraints; +import org.jooq.meta.duckdb.system.main.tables.DuckdbDatabases; +import org.jooq.meta.duckdb.system.main.tables.DuckdbIndexes; +import org.jooq.meta.duckdb.system.main.tables.DuckdbSchemas; +import org.jooq.meta.duckdb.system.main.tables.DuckdbTables; +import org.jooq.meta.duckdb.system.main.tables.DuckdbTypes; +import org.jooq.meta.duckdb.system.main.tables.DuckdbViews; + + +/** + * Convenience access to all tables in main. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Tables { + + /** + * The table system.main.duckdb_columns. + */ + public static final DuckdbColumns DUCKDB_COLUMNS = DuckdbColumns.DUCKDB_COLUMNS; + + /** + * The table system.main.duckdb_constraints. + */ + public static final DuckdbConstraints DUCKDB_CONSTRAINTS = DuckdbConstraints.DUCKDB_CONSTRAINTS; + + /** + * The table system.main.duckdb_databases. + */ + public static final DuckdbDatabases DUCKDB_DATABASES = DuckdbDatabases.DUCKDB_DATABASES; + + /** + * The table system.main.duckdb_indexes. + */ + public static final DuckdbIndexes DUCKDB_INDEXES = DuckdbIndexes.DUCKDB_INDEXES; + + /** + * The table system.main.duckdb_schemas. + */ + public static final DuckdbSchemas DUCKDB_SCHEMAS = DuckdbSchemas.DUCKDB_SCHEMAS; + + /** + * The table system.main.duckdb_tables. + */ + public static final DuckdbTables DUCKDB_TABLES = DuckdbTables.DUCKDB_TABLES; + + /** + * The table system.main.duckdb_types. + */ + public static final DuckdbTypes DUCKDB_TYPES = DuckdbTypes.DUCKDB_TYPES; + + /** + * The table system.main.duckdb_views. + */ + public static final DuckdbViews DUCKDB_VIEWS = DuckdbViews.DUCKDB_VIEWS; +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbColumns.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbColumns.java new file mode 100644 index 0000000000..c4a4e98f8b --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbColumns.java @@ -0,0 +1,205 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbColumns extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_columns + */ + public static final DuckdbColumns DUCKDB_COLUMNS = new DuckdbColumns(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_columns.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_columns.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_columns.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_columns.schema_oid. + */ + public final TableField SCHEMA_OID = createField(DSL.name("schema_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_columns.table_name. + */ + public final TableField TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_columns.table_oid. + */ + public final TableField TABLE_OID = createField(DSL.name("table_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_columns.column_name. + */ + public final TableField COLUMN_NAME = createField(DSL.name("column_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_columns.column_index. + */ + public final TableField COLUMN_INDEX = createField(DSL.name("column_index"), SQLDataType.INTEGER, this, ""); + + /** + * The column system.main.duckdb_columns.internal. + */ + public final TableField INTERNAL = createField(DSL.name("internal"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_columns.column_default. + */ + public final TableField COLUMN_DEFAULT = createField(DSL.name("column_default"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_columns.is_nullable. + */ + public final TableField IS_NULLABLE = createField(DSL.name("is_nullable"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_columns.data_type. + */ + public final TableField DATA_TYPE = createField(DSL.name("data_type"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_columns.data_type_id. + */ + public final TableField DATA_TYPE_ID = createField(DSL.name("data_type_id"), SQLDataType.BIGINT, this, ""); + + /** + * The column + * system.main.duckdb_columns.character_maximum_length. + */ + public final TableField CHARACTER_MAXIMUM_LENGTH = createField(DSL.name("character_maximum_length"), SQLDataType.INTEGER, this, ""); + + /** + * The column system.main.duckdb_columns.numeric_precision. + */ + public final TableField NUMERIC_PRECISION = createField(DSL.name("numeric_precision"), SQLDataType.INTEGER, this, ""); + + /** + * The column + * system.main.duckdb_columns.numeric_precision_radix. + */ + public final TableField NUMERIC_PRECISION_RADIX = createField(DSL.name("numeric_precision_radix"), SQLDataType.INTEGER, this, ""); + + /** + * The column system.main.duckdb_columns.numeric_scale. + */ + public final TableField NUMERIC_SCALE = createField(DSL.name("numeric_scale"), SQLDataType.INTEGER, this, ""); + + private DuckdbColumns(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbColumns(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_columns table reference + */ + public DuckdbColumns(String alias) { + this(DSL.name(alias), DUCKDB_COLUMNS); + } + + /** + * Create an aliased system.main.duckdb_columns table reference + */ + public DuckdbColumns(Name alias) { + this(alias, DUCKDB_COLUMNS); + } + + /** + * Create a system.main.duckdb_columns table reference + */ + public DuckdbColumns() { + this(DSL.name("duckdb_columns"), null); + } + + public DuckdbColumns(Table child, ForeignKey key) { + super(child, key, DUCKDB_COLUMNS); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbColumns as(String alias) { + return new DuckdbColumns(DSL.name(alias), this); + } + + @Override + public DuckdbColumns as(Name alias) { + return new DuckdbColumns(alias, this); + } + + @Override + public DuckdbColumns as(Table alias) { + return new DuckdbColumns(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbColumns rename(String name) { + return new DuckdbColumns(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbColumns rename(Name name) { + return new DuckdbColumns(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbColumns rename(Table name) { + return new DuckdbColumns(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbConstraints.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbConstraints.java new file mode 100644 index 0000000000..71d10add45 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbConstraints.java @@ -0,0 +1,192 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbConstraints extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_constraints + */ + public static final DuckdbConstraints DUCKDB_CONSTRAINTS = new DuckdbConstraints(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_constraints.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_constraints.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_constraints.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_constraints.schema_oid. + */ + public final TableField SCHEMA_OID = createField(DSL.name("schema_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_constraints.table_name. + */ + public final TableField TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_constraints.table_oid. + */ + public final TableField TABLE_OID = createField(DSL.name("table_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_constraints.constraint_index. + */ + public final TableField CONSTRAINT_INDEX = createField(DSL.name("constraint_index"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_constraints.constraint_type. + */ + public final TableField CONSTRAINT_TYPE = createField(DSL.name("constraint_type"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_constraints.constraint_text. + */ + public final TableField CONSTRAINT_TEXT = createField(DSL.name("constraint_text"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_constraints.expression. + */ + public final TableField EXPRESSION = createField(DSL.name("expression"), SQLDataType.VARCHAR, this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField CONSTRAINT_COLUMN_INDEXES = createField(DSL.name("constraint_column_indexes"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"BIGINT[]\""), this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField CONSTRAINT_COLUMN_NAMES = createField(DSL.name("constraint_column_names"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"VARCHAR[]\""), this, ""); + + private DuckdbConstraints(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbConstraints(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_constraints table + * reference + */ + public DuckdbConstraints(String alias) { + this(DSL.name(alias), DUCKDB_CONSTRAINTS); + } + + /** + * Create an aliased system.main.duckdb_constraints table + * reference + */ + public DuckdbConstraints(Name alias) { + this(alias, DUCKDB_CONSTRAINTS); + } + + /** + * Create a system.main.duckdb_constraints table reference + */ + public DuckdbConstraints() { + this(DSL.name("duckdb_constraints"), null); + } + + public DuckdbConstraints(Table child, ForeignKey key) { + super(child, key, DUCKDB_CONSTRAINTS); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbConstraints as(String alias) { + return new DuckdbConstraints(DSL.name(alias), this); + } + + @Override + public DuckdbConstraints as(Name alias) { + return new DuckdbConstraints(alias, this); + } + + @Override + public DuckdbConstraints as(Table alias) { + return new DuckdbConstraints(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbConstraints rename(String name) { + return new DuckdbConstraints(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbConstraints rename(Name name) { + return new DuckdbConstraints(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbConstraints rename(Table name) { + return new DuckdbConstraints(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbDatabases.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbDatabases.java new file mode 100644 index 0000000000..d3560c333a --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbDatabases.java @@ -0,0 +1,145 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbDatabases extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_databases + */ + public static final DuckdbDatabases DUCKDB_DATABASES = new DuckdbDatabases(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_databases.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_databases.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_databases.path. + */ + public final TableField PATH = createField(DSL.name("path"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_databases.internal. + */ + public final TableField INTERNAL = createField(DSL.name("internal"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_databases.type. + */ + public final TableField TYPE = createField(DSL.name("type"), SQLDataType.VARCHAR, this, ""); + + private DuckdbDatabases(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbDatabases(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_databases table + * reference + */ + public DuckdbDatabases(String alias) { + this(DSL.name(alias), DUCKDB_DATABASES); + } + + /** + * Create an aliased system.main.duckdb_databases table + * reference + */ + public DuckdbDatabases(Name alias) { + this(alias, DUCKDB_DATABASES); + } + + /** + * Create a system.main.duckdb_databases table reference + */ + public DuckdbDatabases() { + this(DSL.name("duckdb_databases"), null); + } + + public DuckdbDatabases(Table child, ForeignKey key) { + super(child, key, DUCKDB_DATABASES); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbDatabases as(String alias) { + return new DuckdbDatabases(DSL.name(alias), this); + } + + @Override + public DuckdbDatabases as(Name alias) { + return new DuckdbDatabases(alias, this); + } + + @Override + public DuckdbDatabases as(Table alias) { + return new DuckdbDatabases(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbDatabases rename(String name) { + return new DuckdbDatabases(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbDatabases rename(Name name) { + return new DuckdbDatabases(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbDatabases rename(Table name) { + return new DuckdbDatabases(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbIndexes.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbIndexes.java new file mode 100644 index 0000000000..bc27b5fdf5 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbIndexes.java @@ -0,0 +1,178 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbIndexes extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_indexes + */ + public static final DuckdbIndexes DUCKDB_INDEXES = new DuckdbIndexes(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_indexes.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_indexes.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_indexes.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_indexes.schema_oid. + */ + public final TableField SCHEMA_OID = createField(DSL.name("schema_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_indexes.index_name. + */ + public final TableField INDEX_NAME = createField(DSL.name("index_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_indexes.index_oid. + */ + public final TableField INDEX_OID = createField(DSL.name("index_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_indexes.table_name. + */ + public final TableField TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_indexes.table_oid. + */ + public final TableField TABLE_OID = createField(DSL.name("table_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_indexes.is_unique. + */ + public final TableField IS_UNIQUE = createField(DSL.name("is_unique"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_indexes.is_primary. + */ + public final TableField IS_PRIMARY = createField(DSL.name("is_primary"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_indexes.expressions. + */ + public final TableField EXPRESSIONS = createField(DSL.name("expressions"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_indexes.sql. + */ + public final TableField SQL = createField(DSL.name("sql"), SQLDataType.VARCHAR, this, ""); + + private DuckdbIndexes(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbIndexes(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_indexes table reference + */ + public DuckdbIndexes(String alias) { + this(DSL.name(alias), DUCKDB_INDEXES); + } + + /** + * Create an aliased system.main.duckdb_indexes table reference + */ + public DuckdbIndexes(Name alias) { + this(alias, DUCKDB_INDEXES); + } + + /** + * Create a system.main.duckdb_indexes table reference + */ + public DuckdbIndexes() { + this(DSL.name("duckdb_indexes"), null); + } + + public DuckdbIndexes(Table child, ForeignKey key) { + super(child, key, DUCKDB_INDEXES); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbIndexes as(String alias) { + return new DuckdbIndexes(DSL.name(alias), this); + } + + @Override + public DuckdbIndexes as(Name alias) { + return new DuckdbIndexes(alias, this); + } + + @Override + public DuckdbIndexes as(Table alias) { + return new DuckdbIndexes(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbIndexes rename(String name) { + return new DuckdbIndexes(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbIndexes rename(Name name) { + return new DuckdbIndexes(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbIndexes rename(Table name) { + return new DuckdbIndexes(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbSchemas.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbSchemas.java new file mode 100644 index 0000000000..6b763a55c1 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbSchemas.java @@ -0,0 +1,148 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbSchemas extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_schemas + */ + public static final DuckdbSchemas DUCKDB_SCHEMAS = new DuckdbSchemas(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_schemas.oid. + */ + public final TableField OID = createField(DSL.name("oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_schemas.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_schemas.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_schemas.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_schemas.internal. + */ + public final TableField INTERNAL = createField(DSL.name("internal"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_schemas.sql. + */ + public final TableField SQL = createField(DSL.name("sql"), SQLDataType.VARCHAR, this, ""); + + private DuckdbSchemas(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbSchemas(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_schemas table reference + */ + public DuckdbSchemas(String alias) { + this(DSL.name(alias), DUCKDB_SCHEMAS); + } + + /** + * Create an aliased system.main.duckdb_schemas table reference + */ + public DuckdbSchemas(Name alias) { + this(alias, DUCKDB_SCHEMAS); + } + + /** + * Create a system.main.duckdb_schemas table reference + */ + public DuckdbSchemas() { + this(DSL.name("duckdb_schemas"), null); + } + + public DuckdbSchemas(Table child, ForeignKey key) { + super(child, key, DUCKDB_SCHEMAS); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbSchemas as(String alias) { + return new DuckdbSchemas(DSL.name(alias), this); + } + + @Override + public DuckdbSchemas as(Name alias) { + return new DuckdbSchemas(alias, this); + } + + @Override + public DuckdbSchemas as(Table alias) { + return new DuckdbSchemas(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbSchemas rename(String name) { + return new DuckdbSchemas(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbSchemas rename(Name name) { + return new DuckdbSchemas(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbSchemas rename(Table name) { + return new DuckdbSchemas(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbTables.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbTables.java new file mode 100644 index 0000000000..7c9e50ccdd --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbTables.java @@ -0,0 +1,188 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbTables extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_tables + */ + public static final DuckdbTables DUCKDB_TABLES = new DuckdbTables(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_tables.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_tables.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_tables.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_tables.schema_oid. + */ + public final TableField SCHEMA_OID = createField(DSL.name("schema_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_tables.table_name. + */ + public final TableField TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_tables.table_oid. + */ + public final TableField TABLE_OID = createField(DSL.name("table_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_tables.internal. + */ + public final TableField INTERNAL = createField(DSL.name("internal"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_tables.temporary. + */ + public final TableField TEMPORARY = createField(DSL.name("temporary"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_tables.has_primary_key. + */ + public final TableField HAS_PRIMARY_KEY = createField(DSL.name("has_primary_key"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_tables.estimated_size. + */ + public final TableField ESTIMATED_SIZE = createField(DSL.name("estimated_size"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_tables.column_count. + */ + public final TableField COLUMN_COUNT = createField(DSL.name("column_count"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_tables.index_count. + */ + public final TableField INDEX_COUNT = createField(DSL.name("index_count"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_tables.check_constraint_count. + */ + public final TableField CHECK_CONSTRAINT_COUNT = createField(DSL.name("check_constraint_count"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_tables.sql. + */ + public final TableField SQL = createField(DSL.name("sql"), SQLDataType.VARCHAR, this, ""); + + private DuckdbTables(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbTables(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_tables table reference + */ + public DuckdbTables(String alias) { + this(DSL.name(alias), DUCKDB_TABLES); + } + + /** + * Create an aliased system.main.duckdb_tables table reference + */ + public DuckdbTables(Name alias) { + this(alias, DUCKDB_TABLES); + } + + /** + * Create a system.main.duckdb_tables table reference + */ + public DuckdbTables() { + this(DSL.name("duckdb_tables"), null); + } + + public DuckdbTables(Table child, ForeignKey key) { + super(child, key, DUCKDB_TABLES); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbTables as(String alias) { + return new DuckdbTables(DSL.name(alias), this); + } + + @Override + public DuckdbTables as(Name alias) { + return new DuckdbTables(alias, this); + } + + @Override + public DuckdbTables as(Table alias) { + return new DuckdbTables(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbTables rename(String name) { + return new DuckdbTables(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbTables rename(Name name) { + return new DuckdbTables(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbTables rename(Table name) { + return new DuckdbTables(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbTypes.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbTypes.java new file mode 100644 index 0000000000..d7e6053b5a --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbTypes.java @@ -0,0 +1,179 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbTypes extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_types + */ + public static final DuckdbTypes DUCKDB_TYPES = new DuckdbTypes(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_types.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_types.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_types.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_types.schema_oid. + */ + public final TableField SCHEMA_OID = createField(DSL.name("schema_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_types.type_oid. + */ + public final TableField TYPE_OID = createField(DSL.name("type_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_types.type_name. + */ + public final TableField TYPE_NAME = createField(DSL.name("type_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_types.type_size. + */ + public final TableField TYPE_SIZE = createField(DSL.name("type_size"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_types.logical_type. + */ + public final TableField LOGICAL_TYPE = createField(DSL.name("logical_type"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_types.type_category. + */ + public final TableField TYPE_CATEGORY = createField(DSL.name("type_category"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_types.internal. + */ + public final TableField INTERNAL = createField(DSL.name("internal"), SQLDataType.BOOLEAN, this, ""); + + /** + * @deprecated Unknown data type. If this is a qualified, user-defined type, + * it may have been excluded from code generation. If this is a built-in + * type, you can define an explicit {@link org.jooq.Binding} to specify how + * this type should be handled. Deprecation can be turned off using + * {@literal } in your code generator + * configuration. + */ + @Deprecated + public final TableField LABELS = createField(DSL.name("labels"), org.jooq.impl.DefaultDataType.getDefaultDataType("\"VARCHAR[]\""), this, ""); + + private DuckdbTypes(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbTypes(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_types table reference + */ + public DuckdbTypes(String alias) { + this(DSL.name(alias), DUCKDB_TYPES); + } + + /** + * Create an aliased system.main.duckdb_types table reference + */ + public DuckdbTypes(Name alias) { + this(alias, DUCKDB_TYPES); + } + + /** + * Create a system.main.duckdb_types table reference + */ + public DuckdbTypes() { + this(DSL.name("duckdb_types"), null); + } + + public DuckdbTypes(Table child, ForeignKey key) { + super(child, key, DUCKDB_TYPES); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbTypes as(String alias) { + return new DuckdbTypes(DSL.name(alias), this); + } + + @Override + public DuckdbTypes as(Name alias) { + return new DuckdbTypes(alias, this); + } + + @Override + public DuckdbTypes as(Table alias) { + return new DuckdbTypes(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbTypes rename(String name) { + return new DuckdbTypes(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbTypes rename(Name name) { + return new DuckdbTypes(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbTypes rename(Table name) { + return new DuckdbTypes(name.getQualifiedName(), null); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbViews.java b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbViews.java new file mode 100644 index 0000000000..561d54d6c4 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/meta/duckdb/system/main/tables/DuckdbViews.java @@ -0,0 +1,168 @@ +/* + * This file is generated by jOOQ. + */ +package org.jooq.meta.duckdb.system.main.tables; + + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; +import org.jooq.meta.duckdb.system.main.Main; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DuckdbViews extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of system.main.duckdb_views + */ + public static final DuckdbViews DUCKDB_VIEWS = new DuckdbViews(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return Record.class; + } + + /** + * The column system.main.duckdb_views.database_name. + */ + public final TableField DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_views.database_oid. + */ + public final TableField DATABASE_OID = createField(DSL.name("database_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_views.schema_name. + */ + public final TableField SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_views.schema_oid. + */ + public final TableField SCHEMA_OID = createField(DSL.name("schema_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_views.view_name. + */ + public final TableField VIEW_NAME = createField(DSL.name("view_name"), SQLDataType.VARCHAR, this, ""); + + /** + * The column system.main.duckdb_views.view_oid. + */ + public final TableField VIEW_OID = createField(DSL.name("view_oid"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_views.internal. + */ + public final TableField INTERNAL = createField(DSL.name("internal"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_views.temporary. + */ + public final TableField TEMPORARY = createField(DSL.name("temporary"), SQLDataType.BOOLEAN, this, ""); + + /** + * The column system.main.duckdb_views.column_count. + */ + public final TableField COLUMN_COUNT = createField(DSL.name("column_count"), SQLDataType.BIGINT, this, ""); + + /** + * The column system.main.duckdb_views.sql. + */ + public final TableField SQL = createField(DSL.name("sql"), SQLDataType.VARCHAR, this, ""); + + private DuckdbViews(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private DuckdbViews(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased system.main.duckdb_views table reference + */ + public DuckdbViews(String alias) { + this(DSL.name(alias), DUCKDB_VIEWS); + } + + /** + * Create an aliased system.main.duckdb_views table reference + */ + public DuckdbViews(Name alias) { + this(alias, DUCKDB_VIEWS); + } + + /** + * Create a system.main.duckdb_views table reference + */ + public DuckdbViews() { + this(DSL.name("duckdb_views"), null); + } + + public DuckdbViews(Table child, ForeignKey key) { + super(child, key, DUCKDB_VIEWS); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Main.MAIN; + } + + @Override + public DuckdbViews as(String alias) { + return new DuckdbViews(DSL.name(alias), this); + } + + @Override + public DuckdbViews as(Name alias) { + return new DuckdbViews(alias, this); + } + + @Override + public DuckdbViews as(Table alias) { + return new DuckdbViews(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public DuckdbViews rename(String name) { + return new DuckdbViews(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public DuckdbViews rename(Name name) { + return new DuckdbViews(name, null); + } + + /** + * Rename this table + */ + @Override + public DuckdbViews rename(Table name) { + return new DuckdbViews(name.getQualifiedName(), null); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/AsteriskImpl.java b/jOOQ/src/main/java/org/jooq/impl/AsteriskImpl.java index eb72ed1843..591df11de5 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AsteriskImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/AsteriskImpl.java @@ -40,6 +40,7 @@ package org.jooq.impl; // ... // ... import static org.jooq.SQLDialect.DERBY; +import static org.jooq.SQLDialect.DUCKDB; import static org.jooq.SQLDialect.FIREBIRD; import static org.jooq.SQLDialect.H2; import static org.jooq.SQLDialect.HSQLDB; @@ -109,19 +110,15 @@ final class AsteriskImpl extends AbstractQueryPart implements Asterisk { ctx.sql(' ').visit(K_EXCEPT).sql(" (").visit(fields).sql(')'); } + static final Keyword keyword(Context ctx) { + switch (ctx.family()) { - - - - - - - - - - - - + case DUCKDB: + return K_EXCLUDE; + default: + return K_EXCEPT; + } + } @Override public final Asterisk except(String... fieldNames) { diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java index ca4dbf3207..3dc3af2f45 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java @@ -75,6 +75,7 @@ import static org.jooq.SQLDialect.CUBRID; // ... import static org.jooq.SQLDialect.DEFAULT; import static org.jooq.SQLDialect.DERBY; +import static org.jooq.SQLDialect.DUCKDB; // ... import static org.jooq.SQLDialect.FIREBIRD; // ... @@ -337,7 +338,7 @@ final class SelectQueryImpl extends AbstractResultQuery imp static final Set NO_SUPPORT_WINDOW_CLAUSE = SQLDialect.supportedUntil(CUBRID, DERBY, HSQLDB, IGNITE, MARIADB); - private static final Set OPTIONAL_FROM_CLAUSE = SQLDialect.supportedBy(DEFAULT, H2, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, TRINO, YUGABYTEDB); + private static final Set OPTIONAL_FROM_CLAUSE = SQLDialect.supportedBy(DEFAULT, DUCKDB, H2, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, TRINO, YUGABYTEDB); private static final Set REQUIRES_DERIVED_TABLE_DML = SQLDialect.supportedUntil(MYSQL); private static final Set NO_IMPLICIT_GROUP_BY_ON_HAVING = SQLDialect.supportedBy(SQLITE); diff --git a/jOOQ/src/main/java/org/jooq/impl/TableImpl.java b/jOOQ/src/main/java/org/jooq/impl/TableImpl.java index 075395e3d2..86d905386f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/TableImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/TableImpl.java @@ -45,6 +45,7 @@ import static org.jooq.Clause.TABLE_REFERENCE; // ... // ... // ... +import static org.jooq.SQLDialect.DUCKDB; import static org.jooq.SQLDialect.FIREBIRD; import static org.jooq.SQLDialect.HSQLDB; // ... diff --git a/jOOQ/src/main/java/org/jooq/impl/Tools.java b/jOOQ/src/main/java/org/jooq/impl/Tools.java index 94b7b718ca..89e43f338d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Tools.java +++ b/jOOQ/src/main/java/org/jooq/impl/Tools.java @@ -53,6 +53,7 @@ import static org.jooq.ContextConverter.scoped; // ... // ... import static org.jooq.SQLDialect.DERBY; +import static org.jooq.SQLDialect.DUCKDB; // ... import static org.jooq.SQLDialect.FIREBIRD; import static org.jooq.SQLDialect.H2; @@ -5786,6 +5787,7 @@ final class Tools { + private static final void toSQLDDLTypeDeclarationDefault(Context ctx, DataType type) {