Skip to content

Commit

Permalink
[#6956] Add support for CREATE, DROP TRIGGER
Browse files Browse the repository at this point in the history
- Added DSL (CREATE, DROP)
- Added parser support (DROP)
- Added simple integration tests
  • Loading branch information
lukaseder committed Jan 15, 2021
1 parent 7916e2c commit e3bd8d2
Show file tree
Hide file tree
Showing 10 changed files with 597 additions and 557 deletions.
106 changes: 55 additions & 51 deletions jOOQ/src/main/java/org/jooq/CreateTriggerActionStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>CREATE TRIGGER</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
* It is usually not recommended to reference any <code>XYZ*Step</code> 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: <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql">https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql</a>.
* <p>
* Drawbacks of referencing the <code>XYZ*Step</code> types directly:
* <ul>
* <li>They're operating on mutable implementations (as of jOOQ 3.x)</li>
* <li>They're less composable and not easy to get right when dynamic SQL gets
* complex</li>
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*/
@SuppressWarnings({ "unused" })
public interface CreateTriggerActionStep {

/**
* Add the <code>STATEMENT</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerFinalStep statement(Statement... statement);

/**
* Add the <code>STATEMENT</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerFinalStep statement(Collection<? extends Statement> statement);

/**
* Add the <code>STATEMENT</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerFinalStep statement(Statement statement);
}























































120 changes: 62 additions & 58 deletions jOOQ/src/main/java/org/jooq/CreateTriggerEventOfStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>CREATE TRIGGER</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
* It is usually not recommended to reference any <code>XYZ*Step</code> 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: <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql">https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql</a>.
* <p>
* Drawbacks of referencing the <code>XYZ*Step</code> types directly:
* <ul>
* <li>They're operating on mutable implementations (as of jOOQ 3.x)</li>
* <li>They're less composable and not easy to get right when dynamic SQL gets
* complex</li>
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*/
@SuppressWarnings({ "unused" })
public interface CreateTriggerEventOfStep extends CreateTriggerEventOrStep {

/**
* Add the <code>OF</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerEventOrStep of(String... of);

/**
* Add the <code>OF</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerEventOrStep of(Name... of);

/**
* Add the <code>OF</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerEventOrStep of(Field<?>... of);

/**
* Add the <code>OF</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerEventOrStep of(Collection<? extends Field<?>> of);
}






























































106 changes: 55 additions & 51 deletions jOOQ/src/main/java/org/jooq/CreateTriggerEventOnStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>CREATE TRIGGER</code> statement.
* <p>
* <h3>Referencing <code>XYZ*Step</code> types directly from client code</h3>
* <p>
* It is usually not recommended to reference any <code>XYZ*Step</code> 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: <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql">https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql</a>.
* <p>
* Drawbacks of referencing the <code>XYZ*Step</code> types directly:
* <ul>
* <li>They're operating on mutable implementations (as of jOOQ 3.x)</li>
* <li>They're less composable and not easy to get right when dynamic SQL gets
* complex</li>
* <li>They're less readable</li>
* <li>They might have binary incompatible changes between minor releases</li>
* </ul>
*/
@SuppressWarnings({ "unused" })
public interface CreateTriggerEventOnStep {

/**
* Add the <code>ON</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerReferencingStep on(@Stringly.Name String on);

/**
* Add the <code>ON</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerReferencingStep on(Name on);

/**
* Add the <code>ON</code> clause to the <code>CREATE TRIGGER</code> statement.
*/
@Support
@NotNull
CreateTriggerReferencingStep on(Table<?> on);
}























































0 comments on commit e3bd8d2

Please sign in to comment.