diff --git a/jOOQ/src/main/java/org/jooq/conf/UpdateUnchangedRecords.java b/jOOQ/src/main/java/org/jooq/conf/UpdateUnchangedRecords.java new file mode 100644 index 0000000000..46b14b3655 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/conf/UpdateUnchangedRecords.java @@ -0,0 +1,42 @@ + +package org.jooq.conf; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for UpdateUnchangedRecords. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="UpdateUnchangedRecords">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="NEVER"/>
+ *     <enumeration value="SET_PRIMARY_KEY_TO_ITSELF"/>
+ *     <enumeration value="SET_NON_PRIMARY_KEY_TO_THEMSELVES"/>
+ *     <enumeration value="SET_NON_PRIMARY_KEY_TO_RECORD_VALUES"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "UpdateUnchangedRecords") +@XmlEnum +public enum UpdateUnchangedRecords { + + NEVER, + SET_PRIMARY_KEY_TO_ITSELF, + SET_NON_PRIMARY_KEY_TO_THEMSELVES, + SET_NON_PRIMARY_KEY_TO_RECORD_VALUES; + + public String value() { + return name(); + } + + public static UpdateUnchangedRecords fromValue(String v) { + return valueOf(v); + } + +} diff --git a/jOOQ/src/main/java/org/jooq/impl/UpdatableRecordImpl.java b/jOOQ/src/main/java/org/jooq/impl/UpdatableRecordImpl.java index 1fd365f39c..30e9a52181 100644 --- a/jOOQ/src/main/java/org/jooq/impl/UpdatableRecordImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/UpdatableRecordImpl.java @@ -38,6 +38,7 @@ package org.jooq.impl; import static java.lang.Boolean.TRUE; +import static java.util.Arrays.asList; // ... import static org.jooq.SQLDialect.SQLITE; import static org.jooq.conf.SettingsTools.updatablePrimaryKeys; @@ -308,13 +309,15 @@ public class UpdatableRecordImpl> extends TableReco case SET_NON_PRIMARY_KEY_TO_THEMSELVES: for (Field field : storeFields) - query.addValue(field, (Field) field); + if (!asList(keys).contains(field)) + query.addValue(field, (Field) field); break; case SET_NON_PRIMARY_KEY_TO_RECORD_VALUES: for (Field field : storeFields) - changed(field, true); + if (!asList(keys).contains(field)) + changed(field, true); addChangedValues(storeFields, query, merge); break; diff --git a/jOOQ/src/main/resources/xsd/jooq-runtime-3.14.0.xsd b/jOOQ/src/main/resources/xsd/jooq-runtime-3.14.0.xsd new file mode 100644 index 0000000000..eff5e22a86 --- /dev/null +++ b/jOOQ/src/main/resources/xsd/jooq-runtime-3.14.0.xsd @@ -0,0 +1,1072 @@ + + + + + + + + + + +Use this for single-catalog environments, or when all objects are made +available using synonyms]]> + + + + +Setting this to false also implicitly sets "renderCatalog" to false. +

+Use this for single-schema environments, or when all objects are made +available using synonyms]]> + + + + + + + + +This only affects names created through {@link org.jooq.impl.DSL#name(String)} methods (including those that are implicitly created through this method), not {@link org.jooq.impl.DSL#quotedName(String)} or {@link org.jooq.impl.DSL#unquotedName(String)}, whose behaviour cannot be overridden. +

+This setting does not affect any plain SQL usage.]]> + + + + +Names are modified irrespective of the {@link #getRenderQuotedNames()} setting. +

+This setting does not affect any plain SQL usage.]]> + + + + + + + +This is set to "QUOTED" by default for backwards-compatibility. +

+@deprecated - 3.12.0 - [#5909] - Use {@link RenderQuotedNames} and {@link RenderNameCase} instead.]]> + + @java.lang.Deprecated + @java.lang.Deprecated + + + + + + +Named parameter syntax defaults to :name (such as supported by Oracle, JPA, Spring), but +vendor specific parameters may look differently. This flag can be used to determine the prefix to be +used by named parameters, such as @ for SQL Server's @name or $ +for PostgreSQL's $name. +

+"Named indexed" parameters can be obtained in the same way by specifingy {@code ParamType#NAMED} and not +providing a name to parameters, resulting in :1 or @1 or $1, etc.]]> + + + + + + + + + + + +@deprecated - 3.12.0 - [#5909] - Use {@link RenderQuotedNames} and {@link RenderNameCase} instead.]]> + + @java.lang.Deprecated + @java.lang.Deprecated + + + + + + + + + + + + + + + + + + AS keyword in table aliases, if it is optional in the output dialect. This is ignored if the keyword is not supported (e.g. in Oracle)]]> + + + + AS keyword in table aliases, if it is optional in the output dialect.]]> + + + + INNER keyword in INNER JOIN, if it is optional in the output dialect.]]> + + + + OUTER keyword in OUTER JOIN, if it is optional in the output dialect.]]> + + + + +Oracle 11g (and potentially, other databases too) implements scalar subquery caching. With this flag +set to true, users can automatically profit from this feature in all SQL statements.]]> + + + + ORDER BY rn clause should be rendered on emulated paginated queries. +

+Older databases did not support OFFSET .. FETCH pagination, so jOOQ emulates it using derived +tables and ROWNUM (Oracle 11g and older) or ROW_NUMBER() (e.g. DB2, +SQL Server, etc.) filtering. While these subqueries are ordered, the ordering is not +guaranteed to be stable in the outer most queries. It may be stable (and e.g. in Oracle, +it mostly is, if queries are not parallel, or joined to other queries, etc.), so the excess +ORDER BY clause may add some additional performance overhead. This setting forces +jOOQ to not generate the additional ORDER BY clause. +

+For details, see https://github.com/jOOQ/jOOQ/issues/7609.]]> + + + + RETURNING clause should map to SQL Server's OUTPUT clause. +

+SQL Server supports an OUTPUT clause in most DML statements, whose behaviour +is almost identical to RETURNING in Firebird, Oracle, PostgreSQL. Users who +want to prevent jOOQ from rendering this OUTPUT clause can deactivate this flag +to revert to jOOQ calling {@code java.sql.Statement#getGeneratedKeys()} instead, which +is only supported for single row inserts. +

+This OUTPUT clause does not support fetching trigger generated values. In order +to fetch trigger generated values, {@link #fetchTriggerValuesAfterSQLServerOutput} needs to +be enabled as well. +

+For details, see https://github.com/jOOQ/jOOQ/issues/4498.]]> + + + + +By default (i.e. when this setting is set to false jOOQ will only render parenthesis pairs around queries combined with set operators when required. +This is for example the case when set operators are nested, when non-associative operators like EXCEPT are used, or when the queries are rendered as derived tables. +

+When this setting is set to true the queries combined with set operators will always be surrounded by a parenthesis pair. +

+For details, see https://github.com/jOOQ/jOOQ/issues/3676 and https://github.com/jOOQ/jOOQ/issues/9751.]]> + + + + OUTPUT clause. +

+SQL Server OUTPUT statements do not support fetching trigger generated values. +This is a limitation of the {@link #renderOutputForSQLServerReturningClause}. An additional +MERGE statement can run a second query if (and only if) the primary key has been +included in the OUTPUT clause. +

+For details, see https://github.com/jOOQ/jOOQ/issues/4498.]]> + + + + +Historically, prior to ANSI join syntax, joins were implemented by listing tables in +the FROM clause and providing join predicates in the WHERE clause, possibly using vendor specific +operators like (+) (Oracle, DB2) or *= (SQL Server) for outer join +support. For backwards compatibility with older RDBMS versions, ANSI joins in jOOQ code may be +converted to equivalent table lists in generated SQL using this flag. +

+This flag has a limited implementation that supports inner joins (in most cases) and outer joins +(only for simple comparison predicates). +

+This feature is available in the commercial distribution only.]]> + + + + +(Very) historically, prior to ANSI join syntax, joins were implemented by listing tables in +the FROM clause and providing join predicates in the WHERE clause, possibly using vendor specific +operators like (+) (Oracle, DB2) or *= (SQL Server) for outer join +support. Migrating such join syntax is tedious. The jOOQ parser can parse the old syntax and +this flag enables the transformation to ANSI join syntax. +

+This flag has not been implemented yet! +

+This feature is available in the commercial distribution only.]]> + + + + + + + + +Possibilities include: + +- question marks +- named parameters +- named or inlined parameters +- inlined parameters + +This value is overridden by statementType == STATIC_STATEMENT, in +case of which, this defaults to INLINED]]> + + + + + + + + + + + + 0 uses the dialect defaults:

    +
  • {@link org.jooq.SQLDialect#ACCESS} : 768
  • +
  • {@link org.jooq.SQLDialect#ASE} : 2000
  • +
  • {@link org.jooq.SQLDialect#INGRES} : 1024
  • +
  • {@link org.jooq.SQLDialect#ORACLE} : 32767
  • +
  • {@link org.jooq.SQLDialect#POSTGRES} : 32767
  • +
  • {@link org.jooq.SQLDialect#SQLITE} : 999
  • +
  • {@link org.jooq.SQLDialect#SQLSERVER} : 2100
  • +
]]>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +This flag has no effect when "executeWithOptimisticLocking" is turned off.]]> + + + + + + + + INSERT part of {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#merge()} calls.]]> + + + + UPDATE part of {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#merge()} calls.]]> + + + + +Setting this to "true" will allow for updating primary key values through +UpdatableRecord.store() and UpdatableRecord.update().]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Do note that only few databases support this feature. It is supported only in case the INSERT's or UPDATE's +RETURNING clause is fully supported, also for non-IDENTITY columns.]]> + + + + is active, also other values.]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is a potentially destructive feature, which should not be turned on in production. It is useful mostly to quickly switch between branches in a development environment. This feature is available only in commercial distributions.]]> + + + + This is a potentially destructive feature, which should not be turned on in production. It is useful mostly to quickly revert any elements created in a development environment. This feature is available only in commercial distributions.]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SET key = value should be parsed rather than ignored.]]> + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +This catalog will be omitted in rendered SQL.]]> + + + + +This schema will be omitted in rendered SQL.]]> + + + + +Either <catalogs/> or <schemata/> must be provided]]> + + + + +Either <catalogs/> or <schemata/> must be provided]]> + + + + + + + + + + + + + + + + +Either <input/> or <inputExpression/> must be provided]]> + + + + +Either <input/> or <inputExpression/> must be provided]]> + + + + +
  • When this is omitted, you can still apply schema and table mapping.
  • +
  • When <input/> is provided, <output/> is a constant value.
  • +
  • When <inputExpression/> is provided, <output/> is a replacement expression
  • +]]>
    +
    + + + + +
    +
    + + + + + + + + + + + + + +Either <input/> or <inputExpression/> must be provided]]> + + + + +Either <input/> or <inputExpression/> must be provided]]> + + + + +
  • When this is omitted, you can still apply table mapping.
  • +
  • When <input/> is provided, <output/> is a constant value.
  • +
  • When <inputExpression/> is provided, <output/> is a replacement expression
  • +]]>
    +
    + + + + +
    +
    + + + + + + + + + + + + + + +Either <input/> or <inputExpression/> must be provided.]]> + + + + +Either <input/> or <inputExpression/> must be provided]]> + + + + +
  • When <input/> is provided, <output/> is a constant value.
  • +
  • When <inputExpression/> is provided, <output/> is a replacement expression.
  • +]]>
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @java.lang.Deprecated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @java.lang.Deprecated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    \ No newline at end of file