From e3bd8d2faab14c4f27ef123f070e5237acda0690 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 15 Jan 2021 17:39:56 +0100 Subject: [PATCH] [jOOQ/jOOQ#6956] Add support for CREATE, DROP TRIGGER - Added DSL (CREATE, DROP) - Added parser support (DROP) - Added simple integration tests --- .../org/jooq/CreateTriggerActionStep.java | 94 ++++----- .../org/jooq/CreateTriggerEventOfStep.java | 106 ++++++----- .../org/jooq/CreateTriggerEventOnStep.java | 94 ++++----- .../org/jooq/CreateTriggerEventOrStep.java | 94 ++++----- .../java/org/jooq/CreateTriggerEventStep.java | 166 ++++++++-------- .../java/org/jooq/CreateTriggerFinalStep.java | 58 +++--- .../java/org/jooq/CreateTriggerForStep.java | 70 +++---- .../jooq/CreateTriggerReferencingStep.java | 106 ++++++----- .../java/org/jooq/CreateTriggerWhenStep.java | 178 +++++++++--------- .../java/org/jooq/DropTriggerFinalStep.java | 58 +++--- 10 files changed, 532 insertions(+), 492 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerActionStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerActionStep.java index 3ff37bb100..8cf25d7367 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerActionStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerActionStep.java @@ -37,54 +37,58 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerActionStep { - /** - * Add the STATEMENT clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerFinalStep statement(Statement... statement); - /** - * Add the STATEMENT clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerFinalStep statement(Collection statement); - /** - * Add the STATEMENT clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerFinalStep statement(Statement statement); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerEventOfStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerEventOfStep.java index 761eb0233c..921bb6b887 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerEventOfStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerEventOfStep.java @@ -37,61 +37,65 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerEventOfStep extends CreateTriggerEventOrStep { - /** - * Add the OF clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep of(String... of); - /** - * Add the OF clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep of(Name... of); - /** - * Add the OF clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep of(Field... of); - /** - * Add the OF clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep of(Collection> of); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerEventOnStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerEventOnStep.java index 0b519727e4..8cf25d7367 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerEventOnStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerEventOnStep.java @@ -37,54 +37,58 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerEventOnStep { - /** - * Add the ON clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerReferencingStep on(@Stringly.Name String on); - /** - * Add the ON clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerReferencingStep on(Name on); - /** - * Add the ON clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerReferencingStep on(Table on); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerEventOrStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerEventOrStep.java index f6301c02e9..8cf25d7367 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerEventOrStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerEventOrStep.java @@ -37,54 +37,58 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerEventOrStep extends CreateTriggerEventOnStep { - /** - * Add the OR INSERT clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep orInsert(); - /** - * Add the OR UPDATE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOfStep orUpdate(); - /** - * Add the OR DELETE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep orDelete(); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerEventStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerEventStep.java index 84ac21778b..4e748fe93b 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerEventStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerEventStep.java @@ -37,96 +37,100 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerEventStep { - /** - * Add the BEFORE INSERT clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep beforeInsert(); - /** - * Add the AFTER INSERT clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep afterInsert(); - /** - * Add the INSTEAD OF INSERT clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep insteadOfInsert(); - /** - * Add the BEFORE UPDATE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOfStep beforeUpdate(); - /** - * Add the AFTER UPDATE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOfStep afterUpdate(); - /** - * Add the INSTEAD OF UPDATE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOfStep insteadOfUpdate(); - /** - * Add the BEFORE DELETE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep beforeDelete(); - /** - * Add the AFTER DELETE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep afterDelete(); - /** - * Add the INSTEAD OF DELETE clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerEventOrStep insteadOfDelete(); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerFinalStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerFinalStep.java index 092178d39f..8017dfe66e 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerFinalStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerFinalStep.java @@ -37,33 +37,37 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerFinalStep extends DDLQuery { -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerForStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerForStep.java index f1b5b15707..6312365c62 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerForStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerForStep.java @@ -37,40 +37,44 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerForStep extends CreateTriggerWhenStep { - /** - * Add the FOR EACH ROW clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerWhenStep forEachRow(); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerReferencingStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerReferencingStep.java index 51a78b4e3c..921bb6b887 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerReferencingStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerReferencingStep.java @@ -37,61 +37,65 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerReferencingStep extends CreateTriggerForStep { - /** - * Add the REFERENCING OLD AS clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerReferencingStep referencingOldAs(@Stringly.Name String referencingOldAs); - /** - * Add the REFERENCING OLD AS clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerReferencingStep referencingOldAs(Name referencingOldAs); - /** - * Add the REFERENCING NEW AS clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerReferencingStep referencingNewAs(@Stringly.Name String referencingNewAs); - /** - * Add the REFERENCING NEW AS clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerReferencingStep referencingNewAs(Name referencingNewAs); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/CreateTriggerWhenStep.java b/jOOQ/src/main/java/org/jooq/CreateTriggerWhenStep.java index fd9372fdce..9183e4630a 100644 --- a/jOOQ/src/main/java/org/jooq/CreateTriggerWhenStep.java +++ b/jOOQ/src/main/java/org/jooq/CreateTriggerWhenStep.java @@ -37,101 +37,105 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the CREATE TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface CreateTriggerWhenStep extends CreateTriggerActionStep { - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerActionStep when(Field when); - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerActionStep when(Condition... when); - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerActionStep when(Collection when); - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - */ - @Support - @NotNull - CreateTriggerActionStep when(Condition when); - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - * - * @see SQL - */ - @Support - @PlainSQL - @NotNull - CreateTriggerActionStep when(@Stringly.SQL String when, QueryPart... parts); - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - * - * @see SQL - */ - @Support - @PlainSQL - @NotNull - CreateTriggerActionStep when(@Stringly.SQL String when, Object... bindings); - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - * - * @see SQL - */ - @Support - @PlainSQL - @NotNull - CreateTriggerActionStep when(@Stringly.SQL String when); - /** - * Add the WHEN clause to the CREATE TRIGGER statement. - * - * @see SQL - */ - @Support - @PlainSQL - @NotNull - CreateTriggerActionStep when(SQL when); -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/DropTriggerFinalStep.java b/jOOQ/src/main/java/org/jooq/DropTriggerFinalStep.java index 38750b9ecd..8017dfe66e 100644 --- a/jOOQ/src/main/java/org/jooq/DropTriggerFinalStep.java +++ b/jOOQ/src/main/java/org/jooq/DropTriggerFinalStep.java @@ -37,33 +37,37 @@ */ package org.jooq; -import static org.jooq.SQLDialect.*; -import java.util.*; -import org.jetbrains.annotations.*; -/** - * A step in the construction of the DROP TRIGGER statement. - *

- *

Referencing XYZ*Step types directly from client code

- *

- * It is usually not recommended to reference any XYZ*Step types - * directly from client code, or assign them to local variables. When writing - * dynamic SQL, creating a statement's components dynamically, and passing them - * to the DSL API statically is usually a better choice. See the manual's - * section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql. - *

- * Drawbacks of referencing the XYZ*Step types directly: - *

- */ -@SuppressWarnings({ "unused" }) -public interface DropTriggerFinalStep extends DDLQuery { -} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +