diff --git a/jOOQ/src/main/java/org/jooq/InsertOnConflictConditionStep.java b/jOOQ/src/main/java/org/jooq/InsertOnConflictConditionStep.java index 327c6a2d27..2f18cc091b 100644 --- a/jOOQ/src/main/java/org/jooq/InsertOnConflictConditionStep.java +++ b/jOOQ/src/main/java/org/jooq/InsertOnConflictConditionStep.java @@ -53,7 +53,8 @@ import org.jooq.impl.DSL; * .values(value3, value4) * .onDuplicateKeyUpdate() * .set(field1, value1) - * .set(field2, value2) + * .where(field2.eq(value5)) + * .or(field2.eq(value6)) * .execute(); * *

diff --git a/jOOQ/src/main/java/org/jooq/InsertOnConflictDoUpdateStep.java b/jOOQ/src/main/java/org/jooq/InsertOnConflictDoUpdateStep.java index 2bba395c6b..626548bebc 100644 --- a/jOOQ/src/main/java/org/jooq/InsertOnConflictDoUpdateStep.java +++ b/jOOQ/src/main/java/org/jooq/InsertOnConflictDoUpdateStep.java @@ -58,9 +58,7 @@ import static org.jooq.SQLDialect.POSTGRES_9_5; * * create.insertInto(table, field1, field2) * .values(value1, value2) - * .values(value3, value4) - * .onDuplicateKeyUpdate() - * .set(field1, value1) + * .onConflict(field1) * .set(field2, value2) * .execute(); * @@ -77,7 +75,7 @@ public interface InsertOnConflictDoUpdateStep { InsertOnDuplicateSetStep doUpdate(); /** - * Add the DO IGNORE clause. + * Add the DO NOTHING clause. */ @Support InsertReturningStep doNothing(); diff --git a/jOOQ/src/main/java/org/jooq/InsertOnConflictWhereStep.java b/jOOQ/src/main/java/org/jooq/InsertOnConflictWhereStep.java index 034f15c9bf..f2ce0c0bfa 100644 --- a/jOOQ/src/main/java/org/jooq/InsertOnConflictWhereStep.java +++ b/jOOQ/src/main/java/org/jooq/InsertOnConflictWhereStep.java @@ -59,7 +59,7 @@ import org.jooq.impl.DSL; * .values(value3, value4) * .onDuplicateKeyUpdate() * .set(field1, value1) - * .set(field2, value2) + * .where(field2.eq(value5)) * .execute(); * *

@@ -86,34 +86,38 @@ import org.jooq.impl.DSL; public interface InsertOnConflictWhereStep extends InsertReturningStep { /** - * Add a WHERE clause to the query, connecting them with each - * other with {@link Operator#AND}. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. */ @Support({ CUBRID, DERBY, POSTGRES_9_5 }) InsertOnConflictConditionStep where(Condition condition); /** - * Add a WHERE clause to the query, connecting them with each - * other with {@link Operator#AND}. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause, + * connecting them with each other using {@link Operator#AND}. */ @Support({ CUBRID, DERBY, POSTGRES_9_5 }) InsertOnConflictConditionStep where(Condition... conditions); /** - * Add a WHERE clause to the query, connecting them with each - * other with {@link Operator#AND}. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause, + * connecting them with each other using {@link Operator#AND}. */ @Support({ CUBRID, DERBY, POSTGRES_9_5 }) InsertOnConflictConditionStep where(Collection conditions); /** - * Add a WHERE clause to the query. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. */ @Support({ CUBRID, DERBY, POSTGRES_9_5 }) InsertOnConflictConditionStep where(Field field); /** - * Add a WHERE clause to the query. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of @@ -128,7 +132,8 @@ public interface InsertOnConflictWhereStep extends InsertRetur InsertOnConflictConditionStep where(SQL sql); /** - * Add a WHERE clause to the query. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of @@ -143,7 +148,8 @@ public interface InsertOnConflictWhereStep extends InsertRetur InsertOnConflictConditionStep where(String sql); /** - * Add a WHERE clause to the query. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of @@ -159,7 +165,8 @@ public interface InsertOnConflictWhereStep extends InsertRetur InsertOnConflictConditionStep where(String sql, Object... bindings); /** - * Add a WHERE clause to the query. + * Add a WHERE clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of @@ -175,13 +182,15 @@ public interface InsertOnConflictWhereStep extends InsertRetur InsertOnConflictConditionStep where(String sql, QueryPart... parts); /** - * Add a WHERE EXISTS clause to the query. + * Add a WHERE EXISTS clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. */ @Support({ CUBRID, DERBY, POSTGRES_9_5 }) InsertOnConflictConditionStep whereExists(Select select); /** - * Add a WHERE NOT EXISTS clause to the query. + * Add a WHERE NOT EXISTS clause to the INSERT statement's + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. */ @Support({ CUBRID, DERBY, POSTGRES_9_5 }) InsertOnConflictConditionStep whereNotExists(Select select); diff --git a/jOOQ/src/main/java/org/jooq/InsertOnDuplicateSetStep.java b/jOOQ/src/main/java/org/jooq/InsertOnDuplicateSetStep.java index b0a1194af5..d8d4460483 100644 --- a/jOOQ/src/main/java/org/jooq/InsertOnDuplicateSetStep.java +++ b/jOOQ/src/main/java/org/jooq/InsertOnDuplicateSetStep.java @@ -93,28 +93,28 @@ public interface InsertOnDuplicateSetStep { /** * Set values for UPDATE in the INSERT statement's - * ON DUPLICATE KEY UPDATE clause. + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. */ @Support({ CUBRID, DERBY, HSQLDB, MARIADB, MYSQL, POSTGRES_9_5 }) InsertOnDuplicateSetMoreStep set(Field field, T value); /** * Set values for UPDATE in the INSERT statement's - * ON DUPLICATE KEY UPDATE clause. + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. */ @Support({ CUBRID, DERBY, HSQLDB, MARIADB, MYSQL, POSTGRES_9_5 }) InsertOnDuplicateSetMoreStep set(Field field, Field value); /** * Set values for UPDATE in the INSERT statement's - * ON DUPLICATE KEY UPDATE clause. + * ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. */ @Support({ CUBRID, DERBY, HSQLDB, MARIADB, MYSQL, POSTGRES_9_5 }) InsertOnDuplicateSetMoreStep set(Field field, Select> value); /** * Set multiple values for UPDATE in the INSERT - * statement's ON DUPLICATE KEY UPDATE clause. + * statement's ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. *

* Keys can either be of type {@link String}, {@link Name}, or * {@link Field}. @@ -128,7 +128,7 @@ public interface InsertOnDuplicateSetStep { /** * Set multiple values for UPDATE in the INSERT - * statement's ON DUPLICATE KEY UPDATE clause. + * statement's ON DUPLICATE KEY UPDATE or ON CONFLICT ... DO UPDATE clause. *

* This is the same as calling {@link #set(Map)} with the argument record * treated as a Map<Field<?>, Object>. diff --git a/jOOQ/src/main/java/org/jooq/InsertOnDuplicateStep.java b/jOOQ/src/main/java/org/jooq/InsertOnDuplicateStep.java index e61da4b2e7..cfcde674ad 100644 --- a/jOOQ/src/main/java/org/jooq/InsertOnDuplicateStep.java +++ b/jOOQ/src/main/java/org/jooq/InsertOnDuplicateStep.java @@ -93,25 +93,25 @@ import java.util.Collection; public interface InsertOnDuplicateStep extends InsertReturningStep { /** - * Add a ON CONFLICT ON CONSTRAINT clause to this query. + * Add a ON CONFLICT ON CONSTRAINT clause to this INSERT statement. */ @Support({ CUBRID, DERBY, FIREBIRD_3_0, HSQLDB, POSTGRES_9_5 }) InsertOnConflictDoUpdateStep onConflictOnConstraint(Constraint constraint); /** - * Add a ON CONFLICT ON CONSTRAINT clause to this query. + * Add a ON CONFLICT ON CONSTRAINT clause to this INSERT statement. */ @Support({ CUBRID, DERBY, FIREBIRD_3_0, HSQLDB, POSTGRES_9_5 }) InsertOnConflictDoUpdateStep onConflictOnConstraint(Name constraint); /** - * Add a ON CONFLICT ON CONSTRAINT clause to this query. + * Add a ON CONFLICT ON CONSTRAINT clause to this INSERT statement. */ @Support InsertOnConflictDoUpdateStep onConflictOnConstraint(UniqueKey constraint); /** - * Add an ON CONFLICT clause to this insert query. + * Add an ON CONFLICT clause to this INSERT statement. *

* Only {@link SQLDialect#POSTGRES} has native support for this clause. The * other dialects can emulate it using MERGE, if table meta @@ -121,7 +121,7 @@ public interface InsertOnDuplicateStep extends InsertReturning InsertOnConflictDoUpdateStep onConflict(Field... keys); /** - * Add an ON CONFLICT clause to this insert query. + * Add an ON CONFLICT clause to this INSERT statement. *

* Only {@link SQLDialect#POSTGRES} has native support for this clause. The * other dialects can emulate it using MERGE, if table meta @@ -131,7 +131,7 @@ public interface InsertOnDuplicateStep extends InsertReturning InsertOnConflictDoUpdateStep onConflict(Collection> keys); /** - * Add an ON CONFLICT DO NOTHING clause to this insert query. + * Add an ON CONFLICT DO NOTHING clause to this INSERT statement. *

* Only {@link SQLDialect#POSTGRES} has native support for this clause. The * other dialects can emulate it using MERGE, if table meta @@ -141,7 +141,7 @@ public interface InsertOnDuplicateStep extends InsertReturning InsertReturningStep onConflictDoNothing(); /** - * Add an ON DUPLICATE KEY UPDATE clause to this insert query. + * Add an ON DUPLICATE KEY UPDATE clause to this INSERT statement. *

* This will try to INSERT a record. If there is a primary key * or unique key in this INSERT statement's affected table that @@ -164,7 +164,7 @@ public interface InsertOnDuplicateStep extends InsertReturning InsertOnDuplicateSetStep onDuplicateKeyUpdate(); /** - * Add an ON DUPLICATE KEY IGNORE clause to this insert query. + * Add an ON DUPLICATE KEY IGNORE clause to this INSERT statement. *

* This will try to INSERT a record. If there is a primary key * or unique key in this INSERT statement's affected table that