diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/FirebirdDatabase.java b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/FirebirdDatabase.java
index 3275dc4709..8f904c455d 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/FirebirdDatabase.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/FirebirdDatabase.java
@@ -41,8 +41,10 @@ import static org.jooq.impl.DSL.choose;
import static org.jooq.impl.DSL.decode;
import static org.jooq.impl.DSL.falseCondition;
import static org.jooq.impl.DSL.inline;
+import static org.jooq.impl.DSL.max;
import static org.jooq.impl.DSL.noCondition;
import static org.jooq.impl.DSL.select;
+import static org.jooq.meta.firebird.rdb.Tables.RDB$CHECK_CONSTRAINTS;
import static org.jooq.meta.firebird.rdb.Tables.RDB$GENERATORS;
import static org.jooq.meta.firebird.rdb.Tables.RDB$INDEX_SEGMENTS;
import static org.jooq.meta.firebird.rdb.Tables.RDB$INDICES;
@@ -50,6 +52,7 @@ import static org.jooq.meta.firebird.rdb.Tables.RDB$PROCEDURES;
import static org.jooq.meta.firebird.rdb.Tables.RDB$REF_CONSTRAINTS;
import static org.jooq.meta.firebird.rdb.Tables.RDB$RELATIONS;
import static org.jooq.meta.firebird.rdb.Tables.RDB$RELATION_CONSTRAINTS;
+import static org.jooq.meta.firebird.rdb.Tables.RDB$TRIGGERS;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -70,6 +73,7 @@ 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.DefaultIndexColumnDefinition;
import org.jooq.meta.DefaultRelations;
@@ -84,11 +88,13 @@ import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.SequenceDefinition;
import org.jooq.meta.TableDefinition;
import org.jooq.meta.UDTDefinition;
+import org.jooq.meta.firebird.rdb.tables.Rdb$checkConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$fields;
import org.jooq.meta.firebird.rdb.tables.Rdb$indexSegments;
import org.jooq.meta.firebird.rdb.tables.Rdb$indices;
import org.jooq.meta.firebird.rdb.tables.Rdb$refConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$relationConstraints;
+import org.jooq.meta.firebird.rdb.tables.Rdb$triggers;
import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.util.firebird.FirebirdDataType;
@@ -200,8 +206,44 @@ public class FirebirdDatabase extends AbstractDatabase {
}
@Override
- protected void loadCheckConstraints(DefaultRelations r) throws SQLException {
- // Currently not supported
+ protected void loadCheckConstraints(DefaultRelations relations) throws SQLException {
+ Rdb$relationConstraints r = RDB$RELATION_CONSTRAINTS.as("r");
+ Rdb$checkConstraints c = RDB$CHECK_CONSTRAINTS.as("c");
+ Rdb$triggers t = RDB$TRIGGERS.as("t");
+
+ // [#7639] RDB$TRIGGERS is not in 3NF. The RDB$TRIGGER_SOURCE is repeated
+ // for RDB$TRIGGER_TYPE 1 (before insert) and 3 (before update)
+ for (Record record : create()
+ .select(
+ r.RDB$RELATION_NAME.trim().as(r.RDB$RELATION_NAME),
+ r.RDB$CONSTRAINT_NAME.trim().as(r.RDB$CONSTRAINT_NAME),
+ max(t.RDB$TRIGGER_SOURCE.trim()).as(t.RDB$TRIGGER_SOURCE)
+ )
+ .from(r)
+ .join(c).on(r.RDB$CONSTRAINT_NAME.eq(c.RDB$CONSTRAINT_NAME))
+ .join(t).on(c.RDB$TRIGGER_NAME.eq(t.RDB$TRIGGER_NAME))
+ .where(r.RDB$CONSTRAINT_TYPE.eq(inline("CHECK")))
+ .groupBy(
+ r.RDB$RELATION_NAME,
+ r.RDB$CONSTRAINT_NAME
+ )
+ .orderBy(
+ r.RDB$RELATION_NAME,
+ r.RDB$CONSTRAINT_NAME
+ )
+ ) {
+ SchemaDefinition schema = getSchemata().get(0);
+ TableDefinition table = getTable(schema, record.get(r.RDB$RELATION_NAME));
+
+ if (table != null) {
+ relations.addCheckConstraint(table, new DefaultCheckConstraintDefinition(
+ schema,
+ table,
+ record.get(r.RDB$CONSTRAINT_NAME),
+ record.get(t.RDB$TRIGGER_SOURCE)
+ ));
+ }
+ }
}
@Override
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/DefaultSchema.java b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/DefaultSchema.java
index 1561b72097..2a64d9621f 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/DefaultSchema.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/DefaultSchema.java
@@ -11,6 +11,7 @@ import java.util.List;
import org.jooq.Catalog;
import org.jooq.Table;
import org.jooq.impl.SchemaImpl;
+import org.jooq.meta.firebird.rdb.tables.Rdb$checkConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$fields;
import org.jooq.meta.firebird.rdb.tables.Rdb$generators;
import org.jooq.meta.firebird.rdb.tables.Rdb$indexSegments;
@@ -21,6 +22,7 @@ import org.jooq.meta.firebird.rdb.tables.Rdb$refConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$relationConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$relationFields;
import org.jooq.meta.firebird.rdb.tables.Rdb$relations;
+import org.jooq.meta.firebird.rdb.tables.Rdb$triggers;
/**
@@ -29,13 +31,18 @@ import org.jooq.meta.firebird.rdb.tables.Rdb$relations;
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DefaultSchema extends SchemaImpl {
- private static final long serialVersionUID = 167286145;
+ private static final long serialVersionUID = 1050592337;
/**
* The reference instance of
*/
public static final DefaultSchema DEFAULT_SCHEMA = new DefaultSchema();
+ /**
+ * The table RDB$CHECK_CONSTRAINTS.
+ */
+ public final Rdb$checkConstraints RDB$CHECK_CONSTRAINTS = org.jooq.meta.firebird.rdb.tables.Rdb$checkConstraints.RDB$CHECK_CONSTRAINTS;
+
/**
* The table RDB$FIELDS.
*/
@@ -86,6 +93,11 @@ public class DefaultSchema extends SchemaImpl {
*/
public final Rdb$relationFields RDB$RELATION_FIELDS = org.jooq.meta.firebird.rdb.tables.Rdb$relationFields.RDB$RELATION_FIELDS;
+ /**
+ * The table RDB$TRIGGERS.
+ */
+ public final Rdb$triggers RDB$TRIGGERS = org.jooq.meta.firebird.rdb.tables.Rdb$triggers.RDB$TRIGGERS;
+
/**
* No further instances allowed
*/
@@ -108,6 +120,7 @@ public class DefaultSchema extends SchemaImpl {
private final List
> getTables0() {
return Arrays.>asList(
+ Rdb$checkConstraints.RDB$CHECK_CONSTRAINTS,
Rdb$fields.RDB$FIELDS,
Rdb$generators.RDB$GENERATORS,
Rdb$indexSegments.RDB$INDEX_SEGMENTS,
@@ -117,6 +130,7 @@ public class DefaultSchema extends SchemaImpl {
Rdb$refConstraints.RDB$REF_CONSTRAINTS,
Rdb$relations.RDB$RELATIONS,
Rdb$relationConstraints.RDB$RELATION_CONSTRAINTS,
- Rdb$relationFields.RDB$RELATION_FIELDS);
+ Rdb$relationFields.RDB$RELATION_FIELDS,
+ Rdb$triggers.RDB$TRIGGERS);
}
}
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/Tables.java b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/Tables.java
index 9a32d5862b..1450749c2f 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/Tables.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/Tables.java
@@ -4,6 +4,7 @@
package org.jooq.meta.firebird.rdb;
+import org.jooq.meta.firebird.rdb.tables.Rdb$checkConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$fields;
import org.jooq.meta.firebird.rdb.tables.Rdb$generators;
import org.jooq.meta.firebird.rdb.tables.Rdb$indexSegments;
@@ -14,6 +15,7 @@ import org.jooq.meta.firebird.rdb.tables.Rdb$refConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$relationConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$relationFields;
import org.jooq.meta.firebird.rdb.tables.Rdb$relations;
+import org.jooq.meta.firebird.rdb.tables.Rdb$triggers;
/**
@@ -22,6 +24,11 @@ import org.jooq.meta.firebird.rdb.tables.Rdb$relations;
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Tables {
+ /**
+ * The table RDB$CHECK_CONSTRAINTS.
+ */
+ public static final Rdb$checkConstraints RDB$CHECK_CONSTRAINTS = Rdb$checkConstraints.RDB$CHECK_CONSTRAINTS;
+
/**
* The table RDB$FIELDS.
*/
@@ -71,4 +78,9 @@ public class Tables {
* The table RDB$RELATION_FIELDS.
*/
public static final Rdb$relationFields RDB$RELATION_FIELDS = Rdb$relationFields.RDB$RELATION_FIELDS;
+
+ /**
+ * The table RDB$TRIGGERS.
+ */
+ public static final Rdb$triggers RDB$TRIGGERS = Rdb$triggers.RDB$TRIGGERS;
}
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/tables/Rdb$checkConstraints.java b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/tables/Rdb$checkConstraints.java
new file mode 100644
index 0000000000..75b8187013
--- /dev/null
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/tables/Rdb$checkConstraints.java
@@ -0,0 +1,108 @@
+/*
+ * This file is generated by jOOQ.
+ */
+package org.jooq.meta.firebird.rdb.tables;
+
+
+import org.jooq.Field;
+import org.jooq.Name;
+import org.jooq.Record;
+import org.jooq.Schema;
+import org.jooq.Table;
+import org.jooq.TableField;
+import org.jooq.impl.DSL;
+import org.jooq.impl.TableImpl;
+import org.jooq.meta.firebird.rdb.DefaultSchema;
+
+
+/**
+ * This class is generated by jOOQ.
+ */
+@SuppressWarnings({ "all", "unchecked", "rawtypes" })
+public class Rdb$checkConstraints extends TableImpl {
+
+ private static final long serialVersionUID = -198721383;
+
+ /**
+ * The reference instance of RDB$CHECK_CONSTRAINTS
+ */
+ public static final Rdb$checkConstraints RDB$CHECK_CONSTRAINTS = new Rdb$checkConstraints();
+
+ /**
+ * The class holding records for this type
+ */
+ @Override
+ public Class getRecordType() {
+ return Record.class;
+ }
+
+ /**
+ * The column RDB$CHECK_CONSTRAINTS.RDB$CONSTRAINT_NAME.
+ */
+ public final TableField RDB$CONSTRAINT_NAME = createField(DSL.name("RDB$CONSTRAINT_NAME"), org.jooq.impl.SQLDataType.CHAR(31), this, "");
+
+ /**
+ * The column RDB$CHECK_CONSTRAINTS.RDB$TRIGGER_NAME.
+ */
+ public final TableField RDB$TRIGGER_NAME = createField(DSL.name("RDB$TRIGGER_NAME"), org.jooq.impl.SQLDataType.CHAR(31), this, "");
+
+ /**
+ * Create a RDB$CHECK_CONSTRAINTS table reference
+ */
+ public Rdb$checkConstraints() {
+ this(DSL.name("RDB$CHECK_CONSTRAINTS"), null);
+ }
+
+ /**
+ * Create an aliased RDB$CHECK_CONSTRAINTS table reference
+ */
+ public Rdb$checkConstraints(String alias) {
+ this(DSL.name(alias), RDB$CHECK_CONSTRAINTS);
+ }
+
+ /**
+ * Create an aliased RDB$CHECK_CONSTRAINTS table reference
+ */
+ public Rdb$checkConstraints(Name alias) {
+ this(alias, RDB$CHECK_CONSTRAINTS);
+ }
+
+ private Rdb$checkConstraints(Name alias, Table aliased) {
+ this(alias, aliased, null);
+ }
+
+ private Rdb$checkConstraints(Name alias, Table aliased, Field>[] parameters) {
+ super(alias, null, aliased, parameters, DSL.comment(""));
+ }
+
+ @Override
+ public Schema getSchema() {
+ return DefaultSchema.DEFAULT_SCHEMA;
+ }
+
+ @Override
+ public Rdb$checkConstraints as(String alias) {
+ return new Rdb$checkConstraints(DSL.name(alias), this);
+ }
+
+ @Override
+ public Rdb$checkConstraints as(Name alias) {
+ return new Rdb$checkConstraints(alias, this);
+ }
+
+ /**
+ * Rename this table
+ */
+ @Override
+ public Rdb$checkConstraints rename(String name) {
+ return new Rdb$checkConstraints(DSL.name(name), null);
+ }
+
+ /**
+ * Rename this table
+ */
+ @Override
+ public Rdb$checkConstraints rename(Name name) {
+ return new Rdb$checkConstraints(name, null);
+ }
+}
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/tables/Rdb$triggers.java b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/tables/Rdb$triggers.java
new file mode 100644
index 0000000000..2d237ed123
--- /dev/null
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/firebird/rdb/tables/Rdb$triggers.java
@@ -0,0 +1,180 @@
+/*
+ * This file is generated by jOOQ.
+ */
+package org.jooq.meta.firebird.rdb.tables;
+
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jooq.Field;
+import org.jooq.Name;
+import org.jooq.Record;
+import org.jooq.Schema;
+import org.jooq.Table;
+import org.jooq.TableField;
+import org.jooq.UniqueKey;
+import org.jooq.impl.DSL;
+import org.jooq.impl.Internal;
+import org.jooq.impl.TableImpl;
+import org.jooq.meta.firebird.rdb.DefaultSchema;
+
+
+/**
+ * This class is generated by jOOQ.
+ */
+@SuppressWarnings({ "all", "unchecked", "rawtypes" })
+public class Rdb$triggers extends TableImpl {
+
+ private static final long serialVersionUID = 224941405;
+
+ /**
+ * The reference instance of RDB$TRIGGERS
+ */
+ public static final Rdb$triggers RDB$TRIGGERS = new Rdb$triggers();
+
+ /**
+ * The class holding records for this type
+ */
+ @Override
+ public Class getRecordType() {
+ return Record.class;
+ }
+
+ /**
+ * The column RDB$TRIGGERS.RDB$TRIGGER_NAME.
+ */
+ public final TableField RDB$TRIGGER_NAME = createField(DSL.name("RDB$TRIGGER_NAME"), org.jooq.impl.SQLDataType.CHAR(31), this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$RELATION_NAME.
+ */
+ public final TableField RDB$RELATION_NAME = createField(DSL.name("RDB$RELATION_NAME"), org.jooq.impl.SQLDataType.CHAR(31), this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$TRIGGER_SEQUENCE.
+ */
+ public final TableField RDB$TRIGGER_SEQUENCE = createField(DSL.name("RDB$TRIGGER_SEQUENCE"), org.jooq.impl.SQLDataType.SMALLINT, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$TRIGGER_TYPE.
+ */
+ public final TableField RDB$TRIGGER_TYPE = createField(DSL.name("RDB$TRIGGER_TYPE"), org.jooq.impl.SQLDataType.BIGINT, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$TRIGGER_SOURCE.
+ */
+ public final TableField RDB$TRIGGER_SOURCE = createField(DSL.name("RDB$TRIGGER_SOURCE"), org.jooq.impl.SQLDataType.CLOB, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$TRIGGER_BLR.
+ */
+ public final TableField RDB$TRIGGER_BLR = createField(DSL.name("RDB$TRIGGER_BLR"), org.jooq.impl.SQLDataType.BLOB, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$DESCRIPTION.
+ */
+ public final TableField RDB$DESCRIPTION = createField(DSL.name("RDB$DESCRIPTION"), org.jooq.impl.SQLDataType.CLOB, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$TRIGGER_INACTIVE.
+ */
+ public final TableField RDB$TRIGGER_INACTIVE = createField(DSL.name("RDB$TRIGGER_INACTIVE"), org.jooq.impl.SQLDataType.SMALLINT, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$SYSTEM_FLAG.
+ */
+ public final TableField RDB$SYSTEM_FLAG = createField(DSL.name("RDB$SYSTEM_FLAG"), org.jooq.impl.SQLDataType.SMALLINT.nullable(false), this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$FLAGS.
+ */
+ public final TableField RDB$FLAGS = createField(DSL.name("RDB$FLAGS"), org.jooq.impl.SQLDataType.SMALLINT, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$VALID_BLR.
+ */
+ public final TableField RDB$VALID_BLR = createField(DSL.name("RDB$VALID_BLR"), org.jooq.impl.SQLDataType.SMALLINT, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$DEBUG_INFO.
+ */
+ public final TableField RDB$DEBUG_INFO = createField(DSL.name("RDB$DEBUG_INFO"), org.jooq.impl.SQLDataType.BLOB, this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$ENGINE_NAME.
+ */
+ public final TableField RDB$ENGINE_NAME = createField(DSL.name("RDB$ENGINE_NAME"), org.jooq.impl.SQLDataType.CHAR(31), this, "");
+
+ /**
+ * The column RDB$TRIGGERS.RDB$ENTRYPOINT.
+ */
+ public final TableField RDB$ENTRYPOINT = createField(DSL.name("RDB$ENTRYPOINT"), org.jooq.impl.SQLDataType.CHAR, this, "");
+
+ /**
+ * Create a RDB$TRIGGERS table reference
+ */
+ public Rdb$triggers() {
+ this(DSL.name("RDB$TRIGGERS"), null);
+ }
+
+ /**
+ * Create an aliased RDB$TRIGGERS table reference
+ */
+ public Rdb$triggers(String alias) {
+ this(DSL.name(alias), RDB$TRIGGERS);
+ }
+
+ /**
+ * Create an aliased RDB$TRIGGERS table reference
+ */
+ public Rdb$triggers(Name alias) {
+ this(alias, RDB$TRIGGERS);
+ }
+
+ private Rdb$triggers(Name alias, Table aliased) {
+ this(alias, aliased, null);
+ }
+
+ private Rdb$triggers(Name alias, Table aliased, Field>[] parameters) {
+ super(alias, null, aliased, parameters, DSL.comment(""));
+ }
+
+ @Override
+ public Schema getSchema() {
+ return DefaultSchema.DEFAULT_SCHEMA;
+ }
+
+ @Override
+ public List> getKeys() {
+ return Arrays.>asList(
+ Internal.createUniqueKey(org.jooq.meta.firebird.rdb.tables.Rdb$triggers.RDB$TRIGGERS, "RDB$INDEX_8", org.jooq.meta.firebird.rdb.tables.Rdb$triggers.RDB$TRIGGERS.RDB$TRIGGER_NAME)
+ );
+ }
+
+ @Override
+ public Rdb$triggers as(String alias) {
+ return new Rdb$triggers(DSL.name(alias), this);
+ }
+
+ @Override
+ public Rdb$triggers as(Name alias) {
+ return new Rdb$triggers(alias, this);
+ }
+
+ /**
+ * Rename this table
+ */
+ @Override
+ public Rdb$triggers rename(String name) {
+ return new Rdb$triggers(DSL.name(name), null);
+ }
+
+ /**
+ * Rename this table
+ */
+ @Override
+ public Rdb$triggers rename(Name name) {
+ return new Rdb$triggers(name, null);
+ }
+}