[#11248] Add Trigger runtime meta model - WIP

This commit is contained in:
Lukas Eder 2023-07-04 11:23:25 +02:00
parent b0af10ae45
commit 16f0d2d82f
48 changed files with 1985 additions and 7 deletions

View File

@ -92,6 +92,9 @@ abstract class AbstractGenerator implements Generator {
boolean useSchemaVersionProvider = false;
boolean useCatalogVersionProvider = false;
boolean generateRoutines = true;
boolean generateSequences = true;
boolean generateSequenceFlags = true;
boolean generateUDTs = true;
@ -134,6 +137,9 @@ abstract class AbstractGenerator implements Generator {
boolean generateGlobalSequenceReferences = true;
boolean generateGlobalTableReferences = true;
boolean generateGlobalDomainReferences = true;
boolean generateGlobalUDTReferences = true;
boolean generateGlobalQueueReferences = true;
boolean generateGlobalLinkReferences = true;
@ -538,6 +544,20 @@ abstract class AbstractGenerator implements Generator {
this.generateSequences = generateSequences;
}
@Override
public boolean generateSequenceFlags() {
return generateSequenceFlags;
@ -912,6 +932,20 @@ abstract class AbstractGenerator implements Generator {
this.generateGlobalDomainReferences = globalDomainReferences;
}
@Override
public boolean generateGlobalUDTReferences() {
return generateUDTs() && generateGlobalObjectReferences() && generateGlobalUDTReferences;

View File

@ -152,6 +152,9 @@ public abstract class AbstractGeneratorStrategy implements GeneratorStrategy {
else if (definition instanceof SequenceDefinition
|| definition instanceof DomainDefinition
|| definition instanceof IndexDefinition
|| definition instanceof IdentityDefinition
|| definition instanceof ConstraintDefinition

View File

@ -87,6 +87,7 @@ import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.SyntheticDaoDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.UniqueKeyDefinition;
// ...
@ -396,6 +397,10 @@ public class DefaultGeneratorStrategy extends AbstractGeneratorStrategy {
return "Sequences";
else if (TableDefinition.class.isAssignableFrom(objectType))
return "Tables";
else if (UDTDefinition.class.isAssignableFrom(objectType))
return "UDTs";
else

View File

@ -600,6 +600,9 @@ public class GenerationTool {
database.setIncludePrimaryKeys(!FALSE.equals(d.isIncludePrimaryKeys()));
database.setIncludeRoutines(!FALSE.equals(d.isIncludeRoutines()));
database.setIncludeDomains(!FALSE.equals(d.isIncludeDomains()));
database.setIncludeSequences(!FALSE.equals(d.isIncludeSequences()));
database.setIncludeTables(!FALSE.equals(d.isIncludeTables()));
database.setIncludeEmbeddables(!FALSE.equals(d.isIncludeEmbeddables()));
@ -769,6 +772,10 @@ public class GenerationTool {
generator.setGenerateConstructorPropertiesAnnotationOnRecords(g.getGenerate().isConstructorPropertiesAnnotationOnRecords());
if (g.getGenerate().isRoutines() != null)
generator.setGenerateRoutines(g.getGenerate().isRoutines());
if (g.getGenerate().isSequences() != null)
generator.setGenerateSequences(g.getGenerate().isSequences());
if (g.getGenerate().isSequenceFlags() != null)
@ -841,6 +848,10 @@ public class GenerationTool {
generator.setGenerateGlobalCatalogReferences(g.getGenerate().isGlobalCatalogReferences());
if (g.getGenerate().isGlobalDomainReferences() != null)
generator.setGenerateGlobalDomainReferences(g.getGenerate().isGlobalDomainReferences());
if (g.getGenerate().isGlobalSchemaReferences() != null)
generator.setGenerateGlobalSchemaReferences(g.getGenerate().isGlobalSchemaReferences());
if (g.getGenerate().isGlobalRoutineReferences() != null)

View File

@ -47,6 +47,7 @@ import org.jooq.JSON;
import org.jooq.JSONB;
import org.jooq.Name;
import org.jooq.Path;
// ...
import org.jooq.Spatial;
import org.jooq.Table;
import org.jooq.XML;
@ -364,6 +365,20 @@ public interface Generator {
*/
void setGenerateRoutines(boolean generateRoutines);
/**
* Whether Sequences should be generated.
*/
@ -787,6 +802,22 @@ public interface Generator {
*/
void setGenerateGlobalDomainReferences(boolean globalDomainReferences);
/**
* Whether global queue references should be generated
*/

View File

@ -75,6 +75,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
@ -136,6 +137,10 @@ import org.jooq.Stringly;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
// ...
// ...
// ...
// ...
import org.jooq.UDT;
import org.jooq.UDTField;
import org.jooq.UniqueKey;
@ -193,6 +198,7 @@ import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.SyntheticDaoDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.TypedElementDefinition;
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.UniqueKeyDefinition;
@ -510,6 +516,9 @@ public class JavaGenerator extends AbstractGenerator {
+ ((!generateTables && generateRecords) ? " (forced to true because of <records/>)" :
((!generateTables && generateDaos) ? " (forced to true because of <daos/>)" :
((!generateTables && generateIndexes) ? " (forced to true because of <indexes/>)" : ""))));
log.info(" udts", generateUDTs());
log.info(" relations", generateRelations()
+ ((!generateRelations && generateTables) ? " (forced to true because of <tables/>)" :
@ -584,6 +593,9 @@ public class JavaGenerator extends AbstractGenerator {
return generateEmptySchemas()
|| !database.getArrays(schema).isEmpty()
|| !database.getDomains(schema).isEmpty()
|| !database.getEmbeddables(schema).isEmpty()
|| !database.getEnums(schema).isEmpty()
|| !database.getPackages(schema).isEmpty()
@ -737,6 +749,11 @@ public class JavaGenerator extends AbstractGenerator {
if (generateUDTs() && database.getDomains(schema).size() > 0)
generateDomainReferences(schema);
if (generateRoutines() && (database.getRoutines(schema).size() > 0 || hasTableValuedFunctions(schema)))
generateRoutines(schema);
@ -7917,6 +7934,89 @@ public class JavaGenerator extends AbstractGenerator {
@SuppressWarnings("unused")
protected void generateSequencesClassFooter(SchemaDefinition schema, JavaWriter out) {}
private String numberLiteral(Number n) {
if (n instanceof BigInteger) {
BigInteger bi = (BigInteger) n;
@ -8025,7 +8125,7 @@ public class JavaGenerator extends AbstractGenerator {
out.println("}");
}
printReferences(out, schemas, Schema.class, false);
printReferences(out, schemas, Schema.class);
if (generateJooqVersionReference()) {
String version = org.jooq.codegen.Constants.MINOR_VERSION.replace(".", "_");
@ -8173,19 +8273,27 @@ public class JavaGenerator extends AbstractGenerator {
// [#2255] Avoid referencing sequence literals, if they're not generated
if (generateGlobalSequenceReferences())
printReferences(out, database.getSequences(schema), Sequence.class, true);
printReferences(out, database.getSequences(schema), Sequence.class);
// [#681] Avoid referencing domain literals, if they're not generated
if (generateGlobalDomainReferences())
printReferences(out, database.getDomains(schema), Domain.class, true);
printReferences(out, database.getDomains(schema), Domain.class);
// [#9685] Avoid referencing table literals if they're not generated
if (generateTables())
printReferences(out, database.getTables(schema), Table.class, true);
printReferences(out, database.getTables(schema), Table.class);
// [#9685] Avoid referencing UDT literals if they're not generated
if (generateUDTs())
printReferences(out, database.getUDTs(schema), UDT.class, true);
printReferences(out, database.getUDTs(schema), UDT.class);
generateSchemaClassFooter(schema, out);
out.println("}");
@ -8314,9 +8422,13 @@ public class JavaGenerator extends AbstractGenerator {
}
}
protected void printReferences(JavaWriter out, List<? extends Definition> definitions, Class<?> type, boolean isGeneric) {
protected void printReferences(JavaWriter out, List<? extends Definition> definitions, Class<?> type) {
if (out != null && !definitions.isEmpty()) {
final String generic = isGeneric ? (scala ? "[_]" : kotlin ? "<*>" : "<?>") : "";
final String generic = type.getTypeParameters().length > 0
? Stream.of(type.getTypeParameters())
.map(x -> scala ? "_" : kotlin ? "*" : "?")
.collect(joining(", ", scala ? "[" : "<", scala ? "]" : ">"))
: "";
final List<String> references = new ArrayList<>();
final Definition first = definitions.get(0);

View File

@ -107,6 +107,9 @@
<database>
<inputSchema>public</inputSchema>
</database>
<generate>
<triggers>false</triggers>
</generate>
<target>
<packageName>org.jooq.example.testcontainers.db</packageName>
<directory>src/main/java</directory>

View File

@ -183,6 +183,9 @@
<database>
<inputSchema>public</inputSchema>
</database>
<generate>
<triggers>false</triggers>
</generate>
<target>
<packageName>org.jooq.example.testcontainersflyway.db</packageName>
<directory>src/main/java</directory>

View File

@ -201,6 +201,9 @@ public abstract class AbstractDatabase implements Database {
private boolean includePackageConstants = true;
private boolean includeUDTs = true;
private boolean includeDomains = true;
private boolean includeSequences = true;
private boolean includeIndexes = true;
private boolean includeCheckConstraints = true;
@ -288,6 +291,9 @@ public abstract class AbstractDatabase implements Database {
private List<EmbeddableDefinition> embeddables;
private List<EnumDefinition> enums;
private List<DomainDefinition> domains;
private List<XMLSchemaCollectionDefinition> xmlSchemaCollections;
private List<UDTDefinition> udts;
private List<ArrayDefinition> arrays;
@ -310,6 +316,9 @@ public abstract class AbstractDatabase implements Database {
private transient Map<TableDefinition, List<EmbeddableDefinition>> embeddablesByReferencingTable;
private transient Map<SchemaDefinition, List<EnumDefinition>> enumsBySchema;
private transient Map<SchemaDefinition, List<DomainDefinition>> domainsBySchema;
private transient Map<SchemaDefinition, List<XMLSchemaCollectionDefinition>> xmlSchemaCollectionsBySchema;
private transient Map<SchemaDefinition, List<UDTDefinition>> udtsBySchema;
private transient Map<PackageDefinition, List<UDTDefinition>> udtsByPackage;
@ -1246,6 +1255,20 @@ public abstract class AbstractDatabase implements Database {
this.includeDomains = includeDomains;
}
@Override
public final boolean getIncludeSequences() {
return includeSequences;
@ -2878,6 +2901,58 @@ public abstract class AbstractDatabase implements Database {
return getDefinition(getDomains(schema), name, ignoreCase);
}
@Override
public final List<ArrayDefinition> getArrays(SchemaDefinition schema) {
if (arrays == null) {
@ -3953,6 +4028,17 @@ public abstract class AbstractDatabase implements Database {
*/
protected abstract List<DomainDefinition> getDomains0() throws SQLException;
/**
* Retrieve ALL XML schema collections from the database. This will be
* filtered in {@link #getXMLSchemaCollections()}

View File

@ -245,6 +245,16 @@ public abstract class AbstractMetaDatabase extends AbstractDatabase {
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -47,6 +47,7 @@ import java.util.Properties;
import org.jooq.DSLContext;
import org.jooq.DataType;
import org.jooq.Name;
// ...
import org.jooq.SQLDialect;
import org.jooq.Table;
import org.jooq.TableField;
@ -303,6 +304,46 @@ public interface Database extends AutoCloseable {
*/
DomainDefinition getDomain(SchemaDefinition schema, Name name, boolean ignoreCase);
/**
* The UDTs defined in this database.
*/
@ -638,6 +679,20 @@ public interface Database extends AutoCloseable {
*/
boolean getIncludeDomains();
/**
* whether sequences should be included.
*/

View File

@ -0,0 +1,128 @@
/*
* 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;
import java.util.ArrayList;
import java.util.EnumSet;

View File

@ -0,0 +1,93 @@
/*
* 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;

View File

@ -78,6 +78,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.XMLSchemaCollectionDefinition;
@ -267,6 +268,16 @@ public class CUBRIDDatabase extends AbstractDatabase {
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -105,6 +105,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.XMLSchemaCollectionDefinition;
@ -476,6 +477,16 @@ public class DerbyDatabase extends AbstractDatabase implements ResultQueryDataba
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -85,6 +85,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.XMLSchemaCollectionDefinition;
@ -328,6 +329,16 @@ public class DuckDBDatabase extends AbstractDatabase implements ResultQueryDatab
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -118,6 +118,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.XMLSchemaCollectionDefinition;
import org.jooq.meta.firebird.rdb.tables.Rdb$checkConstraints;
@ -610,6 +611,16 @@ public class FirebirdDatabase extends AbstractDatabase implements ResultQueryDat
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -129,6 +129,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
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.information_schema.Tables;
@ -1159,6 +1160,16 @@ public class H2Database extends AbstractDatabase implements ResultQueryDatabase
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -107,6 +107,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
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.information_schema.tables.CheckConstraints;
@ -560,6 +561,16 @@ public class HSQLDBDatabase extends AbstractDatabase implements ResultQueryDatab
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -78,6 +78,8 @@ public class Database implements Serializable, XMLAppendable
@XmlElement(defaultValue = "true")
protected Boolean includeDomains = true;
@XmlElement(defaultValue = "true")
protected Boolean includeTriggers = true;
@XmlElement(defaultValue = "true")
protected Boolean includeSequences = true;
@XmlElement(defaultValue = "true")
protected Boolean includeIndexes = true;
@ -823,6 +825,32 @@ public class Database implements Serializable, XMLAppendable
this.includeDomains = value;
}
/**
* This flag indicates whether triggers should be included in output produced by this database.
* <p>
* This feature is available in the commercial distribution only.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isIncludeTriggers() {
return includeTriggers;
}
/**
* Sets the value of the includeTriggers property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIncludeTriggers(Boolean value) {
this.includeTriggers = value;
}
/**
* This flag indicates whether sequences should be included in output produced by this database
*
@ -2282,6 +2310,11 @@ public class Database implements Serializable, XMLAppendable
return this;
}
public Database withIncludeTriggers(Boolean value) {
setIncludeTriggers(value);
return this;
}
public Database withIncludeSequences(Boolean value) {
setIncludeSequences(value);
return this;
@ -2854,6 +2887,7 @@ public class Database implements Serializable, XMLAppendable
builder.append("includeXMLSchemaCollections", includeXMLSchemaCollections);
builder.append("includeUDTs", includeUDTs);
builder.append("includeDomains", includeDomains);
builder.append("includeTriggers", includeTriggers);
builder.append("includeSequences", includeSequences);
builder.append("includeIndexes", includeIndexes);
builder.append("includePrimaryKeys", includePrimaryKeys);
@ -3116,6 +3150,15 @@ public class Database implements Serializable, XMLAppendable
return false;
}
}
if (includeTriggers == null) {
if (other.includeTriggers!= null) {
return false;
}
} else {
if (!includeTriggers.equals(other.includeTriggers)) {
return false;
}
}
if (includeSequences == null) {
if (other.includeSequences!= null) {
return false;
@ -3612,6 +3655,7 @@ public class Database implements Serializable, XMLAppendable
result = ((prime*result)+((includeXMLSchemaCollections == null)? 0 :includeXMLSchemaCollections.hashCode()));
result = ((prime*result)+((includeUDTs == null)? 0 :includeUDTs.hashCode()));
result = ((prime*result)+((includeDomains == null)? 0 :includeDomains.hashCode()));
result = ((prime*result)+((includeTriggers == null)? 0 :includeTriggers.hashCode()));
result = ((prime*result)+((includeSequences == null)? 0 :includeSequences.hashCode()));
result = ((prime*result)+((includeIndexes == null)? 0 :includeIndexes.hashCode()));
result = ((prime*result)+((includePrimaryKeys == null)? 0 :includePrimaryKeys.hashCode()));

View File

@ -85,6 +85,8 @@ public class Generate implements Serializable, XMLAppendable
@XmlElement(defaultValue = "true")
protected Boolean sequences = true;
@XmlElement(defaultValue = "true")
protected Boolean triggers = true;
@XmlElement(defaultValue = "true")
protected Boolean udts = true;
@XmlElement(defaultValue = "true")
protected Boolean queues = true;
@ -155,6 +157,8 @@ public class Generate implements Serializable, XMLAppendable
@XmlElement(defaultValue = "true")
protected Boolean globalDomainReferences = true;
@XmlElement(defaultValue = "true")
protected Boolean globalTriggerReferences = true;
@XmlElement(defaultValue = "true")
protected Boolean globalTableReferences = true;
@XmlElement(defaultValue = "true")
protected Boolean globalSequenceReferences = true;
@ -865,6 +869,30 @@ public class Generate implements Serializable, XMLAppendable
this.sequences = value;
}
/**
* Generate Trigger classes.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isTriggers() {
return triggers;
}
/**
* Sets the value of the triggers property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setTriggers(Boolean value) {
this.triggers = value;
}
/**
* Generate UDT classes.
*
@ -1699,6 +1727,30 @@ public class Generate implements Serializable, XMLAppendable
this.globalDomainReferences = value;
}
/**
* Turn off generation of global trigger references.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isGlobalTriggerReferences() {
return globalTriggerReferences;
}
/**
* Sets the value of the globalTriggerReferences property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setGlobalTriggerReferences(Boolean value) {
this.globalTriggerReferences = value;
}
/**
* Turn off generation of global table references.
*
@ -2972,6 +3024,11 @@ public class Generate implements Serializable, XMLAppendable
return this;
}
public Generate withTriggers(Boolean value) {
setTriggers(value);
return this;
}
public Generate withUdts(Boolean value) {
setUdts(value);
return this;
@ -3151,6 +3208,11 @@ public class Generate implements Serializable, XMLAppendable
return this;
}
public Generate withGlobalTriggerReferences(Boolean value) {
setGlobalTriggerReferences(value);
return this;
}
public Generate withGlobalTableReferences(Boolean value) {
setGlobalTableReferences(value);
return this;
@ -3451,6 +3513,7 @@ public class Generate implements Serializable, XMLAppendable
builder.append("constructorPropertiesAnnotationOnRecords", constructorPropertiesAnnotationOnRecords);
builder.append("routines", routines);
builder.append("sequences", sequences);
builder.append("triggers", triggers);
builder.append("udts", udts);
builder.append("queues", queues);
builder.append("links", links);
@ -3486,6 +3549,7 @@ public class Generate implements Serializable, XMLAppendable
builder.append("globalCatalogReferences", globalCatalogReferences);
builder.append("globalSchemaReferences", globalSchemaReferences);
builder.append("globalDomainReferences", globalDomainReferences);
builder.append("globalTriggerReferences", globalTriggerReferences);
builder.append("globalTableReferences", globalTableReferences);
builder.append("globalSequenceReferences", globalSequenceReferences);
builder.append("globalUDTReferences", globalUDTReferences);
@ -3789,6 +3853,15 @@ public class Generate implements Serializable, XMLAppendable
return false;
}
}
if (triggers == null) {
if (other.triggers!= null) {
return false;
}
} else {
if (!triggers.equals(other.triggers)) {
return false;
}
}
if (udts == null) {
if (other.udts!= null) {
return false;
@ -4104,6 +4177,15 @@ public class Generate implements Serializable, XMLAppendable
return false;
}
}
if (globalTriggerReferences == null) {
if (other.globalTriggerReferences!= null) {
return false;
}
} else {
if (!globalTriggerReferences.equals(other.globalTriggerReferences)) {
return false;
}
}
if (globalTableReferences == null) {
if (other.globalTableReferences!= null) {
return false;
@ -4569,6 +4651,7 @@ public class Generate implements Serializable, XMLAppendable
result = ((prime*result)+((constructorPropertiesAnnotationOnRecords == null)? 0 :constructorPropertiesAnnotationOnRecords.hashCode()));
result = ((prime*result)+((routines == null)? 0 :routines.hashCode()));
result = ((prime*result)+((sequences == null)? 0 :sequences.hashCode()));
result = ((prime*result)+((triggers == null)? 0 :triggers.hashCode()));
result = ((prime*result)+((udts == null)? 0 :udts.hashCode()));
result = ((prime*result)+((queues == null)? 0 :queues.hashCode()));
result = ((prime*result)+((links == null)? 0 :links.hashCode()));
@ -4604,6 +4687,7 @@ public class Generate implements Serializable, XMLAppendable
result = ((prime*result)+((globalCatalogReferences == null)? 0 :globalCatalogReferences.hashCode()));
result = ((prime*result)+((globalSchemaReferences == null)? 0 :globalSchemaReferences.hashCode()));
result = ((prime*result)+((globalDomainReferences == null)? 0 :globalDomainReferences.hashCode()));
result = ((prime*result)+((globalTriggerReferences == null)? 0 :globalTriggerReferences.hashCode()));
result = ((prime*result)+((globalTableReferences == null)? 0 :globalTableReferences.hashCode()));
result = ((prime*result)+((globalSequenceReferences == null)? 0 :globalSequenceReferences.hashCode()));
result = ((prime*result)+((globalUDTReferences == null)? 0 :globalUDTReferences.hashCode()));

View File

@ -92,6 +92,7 @@ import static org.jooq.meta.postgres.information_schema.Tables.PARAMETERS;
import static org.jooq.meta.postgres.information_schema.Tables.ROUTINES;
import static org.jooq.meta.postgres.information_schema.Tables.SEQUENCES;
import static org.jooq.meta.postgres.information_schema.Tables.TABLES;
import static org.jooq.meta.postgres.information_schema.Tables.TRIGGERS;
import static org.jooq.meta.postgres.information_schema.Tables.VIEWS;
import static org.jooq.meta.postgres.pg_catalog.Tables.PG_CLASS;
import static org.jooq.meta.postgres.pg_catalog.Tables.PG_CONSTRAINT;
@ -104,13 +105,16 @@ import static org.jooq.meta.postgres.pg_catalog.Tables.PG_NAMESPACE;
import static org.jooq.meta.postgres.pg_catalog.Tables.PG_PROC;
import static org.jooq.meta.postgres.pg_catalog.Tables.PG_SEQUENCE;
import static org.jooq.meta.postgres.pg_catalog.Tables.PG_TYPE;
import static org.jooq.tools.StringUtils.defaultIfNull;
import static org.jooq.util.postgres.PostgresDSL.arrayAppend;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -136,6 +140,9 @@ import org.jooq.SortOrder;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions.TableType;
// ...
// ...
// ...
import org.jooq.conf.ParseUnknownFunctions;
import org.jooq.exception.DataAccessException;
import org.jooq.impl.DSL;
@ -154,6 +161,7 @@ import org.jooq.meta.DefaultEnumDefinition;
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;
@ -164,12 +172,14 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
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.HSQLDBDatabase;
import org.jooq.meta.postgres.information_schema.tables.CheckConstraints;
import org.jooq.meta.postgres.information_schema.tables.KeyColumnUsage;
import org.jooq.meta.postgres.information_schema.tables.Routines;
import org.jooq.meta.postgres.information_schema.tables.Triggers;
import org.jooq.meta.postgres.pg_catalog.tables.PgClass;
import org.jooq.meta.postgres.pg_catalog.tables.PgConstraint;
import org.jooq.meta.postgres.pg_catalog.tables.PgIndex;
@ -904,6 +914,87 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -21,6 +21,7 @@ import org.jooq.meta.postgres.information_schema.tables.Routines;
import org.jooq.meta.postgres.information_schema.tables.Schemata;
import org.jooq.meta.postgres.information_schema.tables.Sequences;
import org.jooq.meta.postgres.information_schema.tables.Tables;
import org.jooq.meta.postgres.information_schema.tables.Triggers;
import org.jooq.meta.postgres.information_schema.tables.Views;
@ -97,6 +98,11 @@ public class InformationSchema extends SchemaImpl {
*/
public final Tables TABLES = Tables.TABLES;
/**
* The table <code>information_schema.triggers</code>.
*/
public final Triggers TRIGGERS = Triggers.TRIGGERS;
/**
* The table <code>information_schema.views</code>.
*/
@ -124,6 +130,7 @@ public class InformationSchema extends SchemaImpl {
Schemata.SCHEMATA,
Sequences.SEQUENCES,
Tables.TABLES,
Triggers.TRIGGERS,
Views.VIEWS
);
}

View File

@ -19,6 +19,7 @@ import org.jooq.meta.postgres.information_schema.tables.Routines;
import org.jooq.meta.postgres.information_schema.tables.Schemata;
import org.jooq.meta.postgres.information_schema.tables.Sequences;
import org.jooq.meta.postgres.information_schema.tables.Tables;
import org.jooq.meta.postgres.information_schema.tables.Triggers;
import org.jooq.meta.postgres.information_schema.tables.Views;
@ -38,6 +39,7 @@ public class Keys {
public static final UniqueKey<Record> 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<Record> SYNTHETIC_PK_SEQUENCES = Internal.createUniqueKey(Sequences.SEQUENCES, DSL.name("SYNTHETIC_PK_sequences"), new TableField[] { Sequences.SEQUENCES.SEQUENCE_CATALOG, Sequences.SEQUENCES.SEQUENCE_SCHEMA, Sequences.SEQUENCES.SEQUENCE_NAME }, true);
public static final UniqueKey<Record> 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);
public static final UniqueKey<Record> SYNTHETIC_PK_TRIGGERS = Internal.createUniqueKey(Triggers.TRIGGERS, DSL.name("SYNTHETIC_PK_triggers"), new TableField[] { Triggers.TRIGGERS.TRIGGER_CATALOG, Triggers.TRIGGERS.TRIGGER_SCHEMA, Triggers.TRIGGERS.TRIGGER_NAME }, true);
// -------------------------------------------------------------------------
// FOREIGN KEY definitions
@ -51,6 +53,7 @@ public class Keys {
public static final ForeignKey<Record, Record> ROUTINES__SYNTHETIC_FK_ROUTINES__SYNTHETIC_PK_SCHEMATA = Internal.createForeignKey(Routines.ROUTINES, DSL.name("SYNTHETIC_FK_routines__SYNTHETIC_PK_schemata"), new TableField[] { Routines.ROUTINES.ROUTINE_CATALOG, Routines.ROUTINES.ROUTINE_SCHEMA }, Keys.SYNTHETIC_PK_SCHEMATA, new TableField[] { Schemata.SCHEMATA.CATALOG_NAME, Schemata.SCHEMATA.SCHEMA_NAME }, true);
public static final ForeignKey<Record, Record> SEQUENCES__SYNTHETIC_FK_SEQUENCES__SYNTHETIC_PK_SCHEMATA = Internal.createForeignKey(Sequences.SEQUENCES, DSL.name("SYNTHETIC_FK_sequences__SYNTHETIC_PK_schemata"), new TableField[] { Sequences.SEQUENCES.SEQUENCE_CATALOG, Sequences.SEQUENCES.SEQUENCE_SCHEMA }, Keys.SYNTHETIC_PK_SCHEMATA, new TableField[] { Schemata.SCHEMATA.CATALOG_NAME, Schemata.SCHEMATA.SCHEMA_NAME }, true);
public static final ForeignKey<Record, Record> TABLES__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);
public static final ForeignKey<Record, Record> TRIGGERS__SYNTHETIC_FK_TRIGGERS__SYNTHETIC_PK_TABLES = Internal.createForeignKey(Triggers.TRIGGERS, DSL.name("SYNTHETIC_FK_triggers__SYNTHETIC_PK_tables"), new TableField[] { Triggers.TRIGGERS.EVENT_OBJECT_CATALOG, Triggers.TRIGGERS.EVENT_OBJECT_SCHEMA }, Keys.SYNTHETIC_PK_TABLES, new TableField[] { Tables.TABLES.TABLE_CATALOG, Tables.TABLES.TABLE_SCHEMA }, true);
public static final ForeignKey<Record, Record> VIEWS__SYNTHETIC_FK_VIEWS__SYNTHETIC_PK_SCHEMATA = Internal.createForeignKey(Views.VIEWS, DSL.name("SYNTHETIC_FK_views__SYNTHETIC_PK_schemata"), new TableField[] { Views.VIEWS.TABLE_CATALOG, Views.VIEWS.TABLE_SCHEMA }, Keys.SYNTHETIC_PK_SCHEMATA, new TableField[] { Schemata.SCHEMATA.CATALOG_NAME, Schemata.SCHEMATA.SCHEMA_NAME }, true);
public static final ForeignKey<Record, Record> VIEWS__SYNTHETIC_FK_VIEWS__SYNTHETIC_PK_TABLES = Internal.createForeignKey(Views.VIEWS, DSL.name("SYNTHETIC_FK_views__SYNTHETIC_PK_tables"), new TableField[] { Views.VIEWS.TABLE_CATALOG, Views.VIEWS.TABLE_SCHEMA, Views.VIEWS.TABLE_NAME }, Keys.SYNTHETIC_PK_TABLES, new TableField[] { Tables.TABLES.TABLE_CATALOG, Tables.TABLES.TABLE_SCHEMA, Tables.TABLES.TABLE_NAME }, true);
}

View File

@ -15,6 +15,7 @@ import org.jooq.meta.postgres.information_schema.tables.ReferentialConstraints;
import org.jooq.meta.postgres.information_schema.tables.Routines;
import org.jooq.meta.postgres.information_schema.tables.Schemata;
import org.jooq.meta.postgres.information_schema.tables.Sequences;
import org.jooq.meta.postgres.information_schema.tables.Triggers;
import org.jooq.meta.postgres.information_schema.tables.Views;
@ -84,6 +85,11 @@ public class Tables {
*/
public static final org.jooq.meta.postgres.information_schema.tables.Tables TABLES = org.jooq.meta.postgres.information_schema.tables.Tables.TABLES;
/**
* The table <code>information_schema.triggers</code>.
*/
public static final Triggers TRIGGERS = Triggers.TRIGGERS;
/**
* The table <code>information_schema.views</code>.
*/

View File

@ -109,10 +109,31 @@ public class CheckConstraints extends TableImpl<Record> {
super(path, childPath, parentPath, CHECK_CONSTRAINTS);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class CheckConstraintsPath extends CheckConstraints implements Path<Record> {
public <O extends Record> CheckConstraintsPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private CheckConstraintsPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public CheckConstraintsPath as(String alias) {
return new CheckConstraintsPath(DSL.name(alias), this);
}
@Override
public CheckConstraintsPath as(Name alias) {
return new CheckConstraintsPath(alias, this);
}
@Override
public CheckConstraintsPath as(Table<?> alias) {
return new CheckConstraintsPath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -304,10 +304,31 @@ public class Columns extends TableImpl<Record> {
super(path, childPath, parentPath, COLUMNS);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class ColumnsPath extends Columns implements Path<Record> {
public <O extends Record> ColumnsPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private ColumnsPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public ColumnsPath as(String alias) {
return new ColumnsPath(DSL.name(alias), this);
}
@Override
public ColumnsPath as(Name alias) {
return new ColumnsPath(alias, this);
}
@Override
public ColumnsPath as(Table<?> alias) {
return new ColumnsPath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -134,10 +134,31 @@ public class KeyColumnUsage extends TableImpl<Record> {
super(path, childPath, parentPath, KEY_COLUMN_USAGE);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class KeyColumnUsagePath extends KeyColumnUsage implements Path<Record> {
public <O extends Record> KeyColumnUsagePath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private KeyColumnUsagePath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public KeyColumnUsagePath as(String alias) {
return new KeyColumnUsagePath(DSL.name(alias), this);
}
@Override
public KeyColumnUsagePath as(Name alias) {
return new KeyColumnUsagePath(alias, this);
}
@Override
public KeyColumnUsagePath as(Table<?> alias) {
return new KeyColumnUsagePath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -138,10 +138,31 @@ public class ReferentialConstraints extends TableImpl<Record> {
super(path, childPath, parentPath, REFERENTIAL_CONSTRAINTS);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class ReferentialConstraintsPath extends ReferentialConstraints implements Path<Record> {
public <O extends Record> ReferentialConstraintsPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private ReferentialConstraintsPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public ReferentialConstraintsPath as(String alias) {
return new ReferentialConstraintsPath(DSL.name(alias), this);
}
@Override
public ReferentialConstraintsPath as(Name alias) {
return new ReferentialConstraintsPath(alias, this);
}
@Override
public ReferentialConstraintsPath as(Table<?> alias) {
return new ReferentialConstraintsPath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -525,10 +525,31 @@ public class Routines extends TableImpl<Record> {
super(path, childPath, parentPath, ROUTINES);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class RoutinesPath extends Routines implements Path<Record> {
public <O extends Record> RoutinesPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private RoutinesPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public RoutinesPath as(String alias) {
return new RoutinesPath(DSL.name(alias), this);
}
@Override
public RoutinesPath as(Name alias) {
return new RoutinesPath(alias, this);
}
@Override
public RoutinesPath as(Table<?> alias) {
return new RoutinesPath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -125,10 +125,31 @@ public class Schemata extends TableImpl<Record> {
super(path, childPath, parentPath, SCHEMATA);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class SchemataPath extends Schemata implements Path<Record> {
public <O extends Record> SchemataPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private SchemataPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public SchemataPath as(String alias) {
return new SchemataPath(DSL.name(alias), this);
}
@Override
public SchemataPath as(Name alias) {
return new SchemataPath(alias, this);
}
@Override
public SchemataPath as(Table<?> alias) {
return new SchemataPath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -144,10 +144,31 @@ public class Sequences extends TableImpl<Record> {
super(path, childPath, parentPath, SEQUENCES);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class SequencesPath extends Sequences implements Path<Record> {
public <O extends Record> SequencesPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private SequencesPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public SequencesPath as(String alias) {
return new SequencesPath(DSL.name(alias), this);
}
@Override
public SequencesPath as(Name alias) {
return new SequencesPath(alias, this);
}
@Override
public SequencesPath as(Table<?> alias) {
return new SequencesPath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -26,6 +26,7 @@ import org.jooq.meta.postgres.information_schema.InformationSchema;
import org.jooq.meta.postgres.information_schema.Keys;
import org.jooq.meta.postgres.information_schema.tables.Columns.ColumnsPath;
import org.jooq.meta.postgres.information_schema.tables.Schemata.SchemataPath;
import org.jooq.meta.postgres.information_schema.tables.Triggers.TriggersPath;
import org.jooq.meta.postgres.information_schema.tables.Views.ViewsPath;
@ -146,10 +147,31 @@ public class Tables extends TableImpl<Record> {
super(path, childPath, parentPath, TABLES);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class TablesPath extends Tables implements Path<Record> {
public <O extends Record> TablesPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private TablesPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public TablesPath as(String alias) {
return new TablesPath(DSL.name(alias), this);
}
@Override
public TablesPath as(Name alias) {
return new TablesPath(alias, this);
}
@Override
public TablesPath as(Table<?> alias) {
return new TablesPath(alias.getQualifiedName(), this);
}
}
@Override
@ -193,6 +215,19 @@ public class Tables extends TableImpl<Record> {
return _columns;
}
private transient TriggersPath _triggers;
/**
* Get the implicit to-many join path to the
* <code>information_schema.triggers</code> table
*/
public TriggersPath triggers() {
if (_triggers == null)
_triggers = new TriggersPath(this, null, Keys.TRIGGERS__SYNTHETIC_FK_TRIGGERS__SYNTHETIC_PK_TABLES.getInverseKey());
return _triggers;
}
private transient ViewsPath _views;
/**

View File

@ -0,0 +1,245 @@
/*
* This file is generated by jOOQ.
*/
package org.jooq.meta.postgres.information_schema.tables;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.InverseForeignKey;
import org.jooq.Name;
import org.jooq.Path;
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.postgres.information_schema.InformationSchema;
import org.jooq.meta.postgres.information_schema.Keys;
import org.jooq.meta.postgres.information_schema.tables.Tables.TablesPath;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Triggers extends TableImpl<Record> {
private static final long serialVersionUID = 1L;
/**
* The reference instance of <code>information_schema.triggers</code>
*/
public static final Triggers TRIGGERS = new Triggers();
/**
* The class holding records for this type
*/
@Override
public Class<Record> getRecordType() {
return Record.class;
}
/**
* The column <code>information_schema.triggers.trigger_catalog</code>.
*/
public final TableField<Record, String> TRIGGER_CATALOG = createField(DSL.name("trigger_catalog"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.trigger_schema</code>.
*/
public final TableField<Record, String> TRIGGER_SCHEMA = createField(DSL.name("trigger_schema"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.trigger_name</code>.
*/
public final TableField<Record, String> TRIGGER_NAME = createField(DSL.name("trigger_name"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.event_manipulation</code>.
*/
public final TableField<Record, String> EVENT_MANIPULATION = createField(DSL.name("event_manipulation"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.event_object_catalog</code>.
*/
public final TableField<Record, String> EVENT_OBJECT_CATALOG = createField(DSL.name("event_object_catalog"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.event_object_schema</code>.
*/
public final TableField<Record, String> EVENT_OBJECT_SCHEMA = createField(DSL.name("event_object_schema"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.event_object_table</code>.
*/
public final TableField<Record, String> EVENT_OBJECT_TABLE = createField(DSL.name("event_object_table"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.action_order</code>.
*/
public final TableField<Record, Integer> ACTION_ORDER = createField(DSL.name("action_order"), SQLDataType.INTEGER, this, "");
/**
* The column <code>information_schema.triggers.action_condition</code>.
*/
public final TableField<Record, String> ACTION_CONDITION = createField(DSL.name("action_condition"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.action_statement</code>.
*/
public final TableField<Record, String> ACTION_STATEMENT = createField(DSL.name("action_statement"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.action_orientation</code>.
*/
public final TableField<Record, String> ACTION_ORIENTATION = createField(DSL.name("action_orientation"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.action_timing</code>.
*/
public final TableField<Record, String> ACTION_TIMING = createField(DSL.name("action_timing"), SQLDataType.VARCHAR, this, "");
/**
* The column
* <code>information_schema.triggers.action_reference_old_table</code>.
*/
public final TableField<Record, String> ACTION_REFERENCE_OLD_TABLE = createField(DSL.name("action_reference_old_table"), SQLDataType.VARCHAR, this, "");
/**
* The column
* <code>information_schema.triggers.action_reference_new_table</code>.
*/
public final TableField<Record, String> ACTION_REFERENCE_NEW_TABLE = createField(DSL.name("action_reference_new_table"), SQLDataType.VARCHAR, this, "");
/**
* The column
* <code>information_schema.triggers.action_reference_old_row</code>.
*/
public final TableField<Record, String> ACTION_REFERENCE_OLD_ROW = createField(DSL.name("action_reference_old_row"), SQLDataType.VARCHAR, this, "");
/**
* The column
* <code>information_schema.triggers.action_reference_new_row</code>.
*/
public final TableField<Record, String> ACTION_REFERENCE_NEW_ROW = createField(DSL.name("action_reference_new_row"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>information_schema.triggers.created</code>.
*/
public final TableField<Record, Timestamp> CREATED = createField(DSL.name("created"), SQLDataType.TIMESTAMP(0), this, "");
private Triggers(Name alias, Table<Record> aliased) {
this(alias, aliased, (Field<?>[]) null, null);
}
private Triggers(Name alias, Table<Record> aliased, Field<?>[] parameters, Condition where) {
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view(), where);
}
/**
* Create an aliased <code>information_schema.triggers</code> table
* reference
*/
public Triggers(String alias) {
this(DSL.name(alias), TRIGGERS);
}
/**
* Create an aliased <code>information_schema.triggers</code> table
* reference
*/
public Triggers(Name alias) {
this(alias, TRIGGERS);
}
/**
* Create a <code>information_schema.triggers</code> table reference
*/
public Triggers() {
this(DSL.name("triggers"), null);
}
public <O extends Record> Triggers(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath, TRIGGERS);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class TriggersPath extends Triggers implements Path<Record> {
public <O extends Record> TriggersPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private TriggersPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public TriggersPath as(String alias) {
return new TriggersPath(DSL.name(alias), this);
}
@Override
public TriggersPath as(Name alias) {
return new TriggersPath(alias, this);
}
@Override
public TriggersPath as(Table<?> alias) {
return new TriggersPath(alias.getQualifiedName(), this);
}
}
@Override
public Schema getSchema() {
return aliased() ? null : InformationSchema.INFORMATION_SCHEMA;
}
@Override
public UniqueKey<Record> getPrimaryKey() {
return Keys.SYNTHETIC_PK_TRIGGERS;
}
@Override
public List<ForeignKey<Record, ?>> getReferences() {
return Arrays.asList(Keys.TRIGGERS__SYNTHETIC_FK_TRIGGERS__SYNTHETIC_PK_TABLES);
}
private transient TablesPath _tables;
/**
* Get the implicit join path to the <code>information_schema.tables</code>
* table.
*/
public TablesPath tables() {
if (_tables == null)
_tables = new TablesPath(this, Keys.TRIGGERS__SYNTHETIC_FK_TRIGGERS__SYNTHETIC_PK_TABLES, null);
return _tables;
}
@Override
public Triggers as(String alias) {
return new Triggers(DSL.name(alias), this);
}
@Override
public Triggers as(Name alias) {
return new Triggers(alias, this);
}
@Override
public Triggers as(Table<?> alias) {
return new Triggers(alias.getQualifiedName(), this);
}
}

View File

@ -132,10 +132,31 @@ public class Views extends TableImpl<Record> {
super(path, childPath, parentPath, VIEWS);
}
/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
public static class ViewsPath extends Views implements Path<Record> {
public <O extends Record> ViewsPath(Table<O> path, ForeignKey<O, Record> childPath, InverseForeignKey<O, Record> parentPath) {
super(path, childPath, parentPath);
}
private ViewsPath(Name alias, Table<Record> aliased) {
super(alias, aliased);
}
@Override
public ViewsPath as(String alias) {
return new ViewsPath(DSL.name(alias), this);
}
@Override
public ViewsPath as(Name alias) {
return new ViewsPath(alias, this);
}
@Override
public ViewsPath as(Table<?> alias) {
return new ViewsPath(alias.getQualifiedName(), this);
}
}
@Override

View File

@ -108,6 +108,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.XMLSchemaCollectionDefinition;
import org.jooq.meta.jaxb.SchemaMappingType;
@ -482,6 +483,16 @@ public class SQLiteDatabase extends AbstractDatabase implements ResultQueryDatab
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -71,6 +71,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
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.HSQLDBDatabase;
@ -170,6 +171,15 @@ public class TrinoDatabase extends AbstractDatabase implements ResultQueryDataba
return new ArrayList<>();
}
@Override
protected List<CatalogDefinition> getCatalogs0() throws SQLException {
List<CatalogDefinition> result = new ArrayList<>();

View File

@ -103,6 +103,7 @@ import org.jooq.meta.RoutineDefinition;
import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
// ...
import org.jooq.meta.UDTDefinition;
import org.jooq.meta.XMLSchemaCollectionDefinition;
import org.jooq.tools.JooqLogger;
@ -584,6 +585,16 @@ public class XMLDatabase extends AbstractDatabase {
return result;
}
@Override
protected List<XMLSchemaCollectionDefinition> getXMLSchemaCollections0() throws SQLException {
List<XMLSchemaCollectionDefinition> result = new ArrayList<>();

View File

@ -767,6 +767,12 @@ Excludes match before includes, i.e. excludes have a higher priority.]]></jxb:ja
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether domains should be included in output produced by this database]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="includeTriggers" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether triggers should be included in output produced by this database.
<p>
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="includeSequences" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This flag indicates whether sequences should be included in output produced by this database]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -2182,6 +2188,10 @@ jOOQ version used for source code.]]></jxb:javadoc></jxb:property></appinfo></an
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate Sequence classes. ]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="triggers" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate Trigger classes. ]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="udts" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate UDT classes. ]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -2330,6 +2340,10 @@ jOOQ version used for source code.]]></jxb:javadoc></jxb:property></appinfo></an
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Turn off generation of global domain references.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="globalTriggerReferences" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Turn off generation of global trigger references.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="globalTableReferences" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Turn off generation of global table references.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>

View File

@ -263,6 +263,36 @@ public interface Schema extends Named {
@Nullable
Domain<?> getDomain(Name name);
/**
* Stream all sequences contained in this schema.
*/

View File

@ -0,0 +1,104 @@
/*
* 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;

View File

@ -0,0 +1,65 @@
/*
* 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;

View File

@ -0,0 +1,60 @@
/*
* 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;

View File

@ -0,0 +1,65 @@
/*
* 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;

View File

@ -46,12 +46,14 @@ import static org.jooq.tools.StringUtils.isBlank;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.jooq.Binding;
import org.jooq.Check;
import org.jooq.Comment;
import org.jooq.Condition;
import org.jooq.Configuration;
import org.jooq.Converter;
import org.jooq.ConverterContext;
@ -84,6 +86,10 @@ import org.jooq.Support;
import org.jooq.Table;
import org.jooq.TableElement;
import org.jooq.TableField;
// ...
// ...
// ...
// ...
import org.jooq.UDT;
import org.jooq.UDTRecord;
import org.jooq.UniqueKey;
@ -289,6 +295,31 @@ public final class Internal {
return new DomainImpl<>(schema, name, actualType, checks);
}
/**
* Factory method for path aliases.
*/

View File

@ -55,6 +55,7 @@ import org.jooq.Schema;
import org.jooq.Sequence;
import org.jooq.Table;
// ...
// ...
import org.jooq.UDT;
import org.jooq.UniqueKey;
import org.jooq.QueryPart;
@ -214,6 +215,25 @@ public final class LazySchema extends AbstractNamed implements Schema {
return schema().getDomain(name);
}
@Override
public final List<Sequence<?>> getSequences() {
return schema().getSequences();
@ -264,6 +284,15 @@ public final class LazySchema extends AbstractNamed implements Schema {
return schema().domainStream();
}
@Override
public final Stream<Sequence<?>> sequenceStream() {
return schema().sequenceStream();

View File

@ -62,6 +62,7 @@ import org.jooq.Name;
import org.jooq.Schema;
import org.jooq.Sequence;
import org.jooq.Table;
// ...
import org.jooq.UDT;
import org.jooq.UniqueKey;
import org.jooq.impl.QOM.UEmpty;
@ -213,6 +214,20 @@ implements
return find(name, getDomains());
}
@Override
public final Sequence<?> getSequence(String name) {
return find(name, getSequences());
@ -299,6 +314,20 @@ implements
return Collections.emptyList();
}
/**
* {@inheritDoc}
* <p>
@ -344,6 +373,15 @@ implements
return getDomains().stream();
}
@Override
public final Stream<Sequence<?>> sequenceStream() {
return getSequences().stream();

View File

@ -0,0 +1,187 @@
/*
* 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.impl;