public interface SelectQuery<R extends Record> extends Select<R>, ConditionProvider
Modifier and Type | Method and Description |
---|---|
void |
addConditions(java.util.Collection<? extends Condition> conditions)
Adds new conditions to the query, connecting them to existing
conditions with
Operator.AND |
void |
addConditions(Condition... conditions)
Adds new conditions to the query, connecting them to existing
conditions with
Operator.AND |
void |
addConditions(Operator operator,
java.util.Collection<? extends Condition> conditions)
Adds new conditions to the query, connecting them to existing
conditions with the provided operator
|
void |
addConditions(Operator operator,
Condition... conditions)
Adds new conditions to the query, connecting them to existing
conditions with the provided operator
|
void |
addConnectBy(Condition condition)
Add an Oracle-specific
CONNECT BY clause to the query. |
void |
addConnectByNoCycle(Condition condition)
Add an Oracle-specific
CONNECT BY NOCYCLE clause to the
query. |
void |
addDistinctOn(java.util.Collection<? extends SelectField<?>> fields)
Add a PostgreSQL-specific DISTINCT ON (fields...)
|
void |
addDistinctOn(SelectField<?>... fields)
Add a PostgreSQL-specific DISTINCT ON (fields...)
|
void |
addFrom(java.util.Collection<? extends TableLike<?>> from)
Add tables to the table product.
|
void |
addFrom(TableLike<?>... from)
Add tables to the table product.
|
void |
addFrom(TableLike<?> from)
Add tables to the table product.
|
void |
addGroupBy(java.util.Collection<? extends GroupField> fields)
Adds grouping fields.
|
void |
addGroupBy(GroupField... fields)
Adds grouping fields.
|
void |
addHaving(java.util.Collection<? extends Condition> conditions)
Adds new conditions to the having clause of the query, connecting them
with each other with
Operator.AND . |
void |
addHaving(Condition... conditions)
Adds new conditions to the having clause of the query, connecting them
with each other with
Operator.AND . |
void |
addHaving(Operator operator,
java.util.Collection<? extends Condition> conditions)
Adds new conditions to the having clause of query, connecting them with
each other with
Operator.AND . |
void |
addHaving(Operator operator,
Condition... conditions)
Adds new conditions to the having clause of query, connecting them with
each other with
Operator.AND . |
void |
addHint(java.lang.String hint)
Add an Oracle-style hint to the select clause.
|
void |
addJoin(TableLike<?> table,
Condition... conditions)
Joins the existing table product to a new table using a condition,
connecting them with each other with
Operator.AND . |
void |
addJoin(TableLike<?> table,
JoinType type,
Condition... conditions)
Joins the existing table product to a new table using a condition,
connecting them with each other with
Operator.AND . |
void |
addJoin(TableLike<?> table,
JoinType type,
Condition[] conditions,
Field<?>[] partitionBy)
Joins the existing table product to a new table using conditions,
connecting them with each other with
Operator.AND . |
void |
addJoinOnKey(TableLike<?> table,
JoinType type)
Joins the existing table product to a new table using a foreign key.
|
void |
addJoinOnKey(TableLike<?> table,
JoinType type,
ForeignKey<?,?> key)
Joins the existing table product to a new table using a foreign key.
|
void |
addJoinOnKey(TableLike<?> table,
JoinType type,
TableField<?,?>... keyFields)
Joins the existing table product to a new table using a foreign key.
|
void |
addJoinUsing(TableLike<?> table,
java.util.Collection<? extends Field<?>> fields)
Joins the existing table product to a new table with a
USING
clause. |
void |
addJoinUsing(TableLike<?> table,
JoinType type,
java.util.Collection<? extends Field<?>> fields)
Joins the existing table product to a new table with a
USING
clause. |
void |
addLimit(int numberOfRows)
Limit the results of this select.
|
void |
addLimit(int offset,
int numberOfRows)
Limit the results of this select.
|
void |
addLimit(int offset,
Param<java.lang.Integer> numberOfRows)
Limit the results of this select using named parameters.
|
void |
addLimit(Param<java.lang.Integer> numberOfRows)
Limit the results of this select using named parameters.
|
void |
addLimit(Param<java.lang.Integer> offset,
int numberOfRows)
Limit the results of this select.
|
void |
addLimit(Param<java.lang.Integer> offset,
Param<java.lang.Integer> numberOfRows)
Limit the results of this select using named parameters.
|
void |
addOffset(int offset)
Add an
OFFSET clause to the query. |
void |
addOffset(Param<java.lang.Integer> offset)
Add an
OFFSET clause to the query using a named parameter. |
void |
addOption(java.lang.String option)
Add a SQL Server-style query hint to the select clause.
|
void |
addOrderBy(java.util.Collection<? extends OrderField<?>> fields)
Adds ordering fields.
|
void |
addOrderBy(int... fieldIndexes)
Adds ordering fields.
|
void |
addOrderBy(OrderField<?>... fields)
Adds ordering fields.
|
void |
addSeekAfter(java.util.Collection<? extends Field<?>> fields)
Adds seeking fields.
|
void |
addSeekAfter(Field<?>... fields)
Adds seeking fields.
|
void |
addSeekBefore(java.util.Collection<? extends Field<?>> fields)
Adds seeking fields.
|
void |
addSeekBefore(Field<?>... fields)
Adds seeking fields.
|
void |
addSelect(java.util.Collection<? extends SelectField<?>> fields)
Add a list of select fields.
|
void |
addSelect(SelectField<?>... fields)
Add a list of select fields.
|
void |
addWindow(java.util.Collection<? extends WindowDefinition> definitions)
Adds new window definitions to the window clause of the query.
|
void |
addWindow(WindowDefinition... definitions)
Adds new window definitions to the window clause of the query.
|
void |
setConnectByStartWith(Condition condition)
Add an Oracle-specific
START WITH clause to the query's
CONNECT BY clause. |
void |
setDistinct(boolean distinct)
Add "distinct" keyword to the select clause.
|
void |
setForShare(boolean forShare)
Sets the "FOR SHARE" flag onto the query.
|
void |
setForUpdate(boolean forUpdate)
Sets the "FOR UPDATE" flag onto the query.
|
void |
setForUpdateNoWait()
Some RDBMS allow for specifying the locking mode for the applied
FOR UPDATE clause. |
void |
setForUpdateOf(java.util.Collection<? extends Field<?>> fields)
Some RDBMS allow for specifying the fields that should be locked by the
FOR UPDATE clause, instead of the full row. |
void |
setForUpdateOf(Field<?>... fields)
Some RDBMS allow for specifying the fields that should be locked by the
FOR UPDATE clause, instead of the full row. |
void |
setForUpdateOf(Table<?>... tables)
Some RDBMS allow for specifying the tables that should be locked by the
FOR UPDATE clause, instead of the full row. |
void |
setForUpdateSkipLocked()
Some RDBMS allow for specifying the locking mode for the applied
FOR UPDATE clause. |
void |
setForUpdateWait(int seconds)
Some RDBMS allow for specifying the locking mode for the applied
FOR UPDATE clause. |
void |
setInto(Table<?> table)
Add
INTO clause to the SELECT statement. |
void |
setOrderBySiblings(boolean orderBySiblings)
Indicate whether the
SIBLINGS keyword should be used in an
ORDER BY clause to form an ORDER SIBLINGS BY
clause. |
void |
setWithCheckOption()
Add a
WITH CHECK OPTION clause to the end of the subquery. |
void |
setWithReadOnly()
Add a
WITH READ ONLY clause to the end of the subquery. |
void |
setWithTies(boolean withTies)
Add the
WITH TIES clause to a LIMIT clause. |
except, exceptAll, fetchCount, getSelect, intersect, intersectAll, union, unionAll
bind, bind, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAnyArray, fetchAnyInto, fetchAnyInto, fetchAnyMap, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArrays, fetchAsync, fetchAsync, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchInto, fetchInto, fetchInto, fetchLater, fetchLater, fetchLazy, fetchLazy, fetchMany, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMaps, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOneArray, fetchOneInto, fetchOneInto, fetchOneMap, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptionalArray, fetchOptionalInto, fetchOptionalInto, fetchOptionalMap, fetchResultSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingleArray, fetchSingleInto, fetchSingleInto, fetchSingleMap, fetchSize, fetchStream, fetchStreamInto, fetchStreamInto, forEach, getRecordType, getResult, intern, intern, intern, intern, iterator, keepStatement, maxRows, queryTimeout, resultSetConcurrency, resultSetHoldability, resultSetType, spliterator, stream
cancel, close, execute, executeAsync, executeAsync, getBindValues, getParam, getParams, getSQL, getSQL, getSQL, isExecutable
attach, configuration, detach
@Support void addSelect(SelectField<?>... fields)
fields
- @Support void addSelect(java.util.Collection<? extends SelectField<?>> fields)
fields
- @Support void setDistinct(boolean distinct)
@Support(value=POSTGRES) void addDistinctOn(SelectField<?>... fields)
DISTINCT ON (fields...)
clause.
This also sets the distinct
flag to true
@Support(value=POSTGRES) void addDistinctOn(java.util.Collection<? extends SelectField<?>> fields)
DISTINCT ON (fields...)
clause.
This also sets the distinct
flag to true
@Support(value={ACCESS,ASE,CUBRID,DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MYSQL,ORACLE,POSTGRES,SQLSERVER,SQLITE}) void setInto(Table<?> table)
INTO
clause to the SELECT
statement.@Support void addFrom(TableLike<?> from)
from
- The added tables@Support void addFrom(TableLike<?>... from)
from
- The added tables@Support void addFrom(java.util.Collection<? extends TableLike<?>> from)
from
- The added tables@Support void addJoin(TableLike<?> table, Condition... conditions)
Operator.AND
.table
- The joined tableconditions
- The joining conditions@Support void addJoin(TableLike<?> table, JoinType type, Condition... conditions)
Operator.AND
.table
- The joined tabletype
- The type of joinconditions
- The joining conditions@Support(value=ORACLE) void addJoin(TableLike<?> table, JoinType type, Condition[] conditions, Field<?>[] partitionBy)
Operator.AND
.
This adds a PARTITION BY
clause to the right hand side of a
OUTER JOIN
expression.
table
- The joined tabletype
- The type of joinconditions
- The joining conditionspartitionBy
- The PARTITION BY
expressionTablePartitionByStep
@Support void addJoinUsing(TableLike<?> table, java.util.Collection<? extends Field<?>> fields)
USING
clause.
If this is not supported by your RDBMS, then jOOQ will try to emulate this behaviour using the information provided in this query.
table
- The joined tablefields
- The fields for the USING
clause@Support void addJoinUsing(TableLike<?> table, JoinType type, java.util.Collection<? extends Field<?>> fields)
USING
clause.
If this is not supported by your RDBMS, then jOOQ will try to emulate this behaviour using the information provided in this query.
table
- The joined tabletype
- The type of joinfields
- The fields for the USING
clause@Support void addJoinOnKey(TableLike<?> table, JoinType type) throws DataAccessException
table
- The joined tabletype
- The type of joinDataAccessException
- If there is no non-ambiguous key definition
known to jOOQTableOnStep.onKey(ForeignKey)
@Support void addJoinOnKey(TableLike<?> table, JoinType type, TableField<?,?>... keyFields) throws DataAccessException
table
- The joined tabletype
- The type of joinkeyFields
- The foreign key fieldsDataAccessException
- If there is no non-ambiguous key definition
known to jOOQTableOnStep.onKey(ForeignKey)
@Support void addJoinOnKey(TableLike<?> table, JoinType type, ForeignKey<?,?> key)
table
- The joined tabletype
- The type of joinkey
- The foreign keyTableOnStep.onKey(ForeignKey)
@Support void addGroupBy(GroupField... fields)
Calling this with an empty argument list will result in an empty
GROUP BY ()
clause being rendered.
fields
- The grouping fields@Support void addGroupBy(java.util.Collection<? extends GroupField> fields)
Calling this with an empty argument list will result in an empty
GROUP BY ()
clause being rendered.
fields
- The grouping fields@Support void addHaving(Condition... conditions)
Operator.AND
.conditions
- The condition@Support void addHaving(java.util.Collection<? extends Condition> conditions)
Operator.AND
.conditions
- The condition@Support void addHaving(Operator operator, Condition... conditions)
Operator.AND
.operator
- The operator to use to add the conditions to the existing
conditionsconditions
- The condition@Support void addHaving(Operator operator, java.util.Collection<? extends Condition> conditions)
Operator.AND
.operator
- The operator to use to add the conditions to the existing
conditionsconditions
- The condition@Support(value={CUBRID,DB2,FIREBIRD_3_0,HANA,INFORMIX,MYSQL_8_0,POSTGRES,ORACLE,SQLSERVER,SYBASE,VERTICA}) void addWindow(WindowDefinition... definitions)
definitions
- The definitions@Support(value={CUBRID,DB2,FIREBIRD_3_0,HANA,INFORMIX,MYSQL_8_0,POSTGRES,ORACLE,SQLSERVER,SYBASE,VERTICA}) void addWindow(java.util.Collection<? extends WindowDefinition> definitions)
definitions
- The definitions@Support void addHint(java.lang.String hint)
Example:
DSLContext create = DSL.using(configuration);
create.select(field1, field2)
.hint("/*+ALL_ROWS*/")
.from(table1)
.execute();
You can also use this clause for any other database, that accepts hints
or options at the same syntactic location, e.g. for MySQL's
SQL_CALC_FOUND_ROWS
option:
create.select(field1, field2)
.hint("SQL_CALC_FOUND_ROWS")
.from(table1)
.fetch();
The outcome of such a query is this:
SELECT [hint] field1, field2 FROM table1
For SQL Server style table hints, see Table.with(String)
Table.with(String)
@Support void addOption(java.lang.String option)
Example:
DSLContext create = DSL.using(configuration);
create.select(field1, field2)
.from(table1)
.option("OPTION (OPTIMIZE FOR UNKNOWN)")
.execute();
You can also use this clause for any other database, that accepts hints
or options at the same syntactic location, e.g. for DB2's isolation clause:
create.select(field1, field2)
.from(table1)
.option("WITH RR USE AND KEEP EXCLUSIVE LOCKS")
.execute();
The outcome of such a query is this:
SELECT field1, field2 FROM table1 [option]
For SQL Server style table hints, see Table.with(String)
Table.with(String)
@Support(value={CUBRID,INFORMIX,ORACLE}) void addConnectBy(Condition condition)
CONNECT BY
clause to the query.@Support(value={CUBRID,INFORMIX,ORACLE}) void addConnectByNoCycle(Condition condition)
CONNECT BY NOCYCLE
clause to the
query.@Support(value={CUBRID,INFORMIX,ORACLE}) void setConnectByStartWith(Condition condition)
START WITH
clause to the query's
CONNECT BY
clause.@Support void addConditions(Condition... conditions)
Operator.AND
addConditions
in interface ConditionProvider
conditions
- The condition@Support void addConditions(java.util.Collection<? extends Condition> conditions)
Operator.AND
addConditions
in interface ConditionProvider
conditions
- The condition@Support void addConditions(Operator operator, Condition... conditions)
addConditions
in interface ConditionProvider
conditions
- The condition@Support void addConditions(Operator operator, java.util.Collection<? extends Condition> conditions)
addConditions
in interface ConditionProvider
conditions
- The condition@Support void addOrderBy(OrderField<?>... fields)
fields
- The ordering fields@Support void addOrderBy(java.util.Collection<? extends OrderField<?>> fields)
fields
- The ordering fields@Support void addOrderBy(int... fieldIndexes)
Indexes start at 1
in SQL!
Note, you can use addOrderBy(DSL.val(1).desc())
or
addOrderBy(DSL.literal(1).desc())
to apply descending
ordering
fieldIndexes
- The ordering fields@Support(value={CUBRID,INFORMIX,ORACLE}) void setOrderBySiblings(boolean orderBySiblings)
SIBLINGS
keyword should be used in an
ORDER BY
clause to form an ORDER SIBLINGS BY
clause.
This clause can be used only along with Oracle's CONNECT BY
clause, to indicate that the hierarchical ordering should be preserved
and elements of each hierarchy should be ordered among themselves.
orderBySiblings
- @Support void addSeekAfter(Field<?>... fields)
fields
- The seeking fields@Support void addSeekAfter(java.util.Collection<? extends Field<?>> fields)
fields
- The seeking fields@Support void addSeekBefore(Field<?>... fields)
fields
- The seeking fields@Support void addSeekBefore(java.util.Collection<? extends Field<?>> fields)
fields
- The seeking fields@Support(value={CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,SYBASE,VERTICA}) void addOffset(int offset)
OFFSET
clause to the query.
If there is no LIMIT .. OFFSET
or TOP
clause in
your RDBMS, or if your RDBMS does not natively support offsets, this is
emulated with a ROW_NUMBER()
window function and nested
SELECT
statements.
@Support(value={CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,SYBASE,VERTICA}) void addOffset(Param<java.lang.Integer> offset)
OFFSET
clause to the query using a named parameter.
If there is no LIMIT .. OFFSET
or TOP
clause in
your RDBMS, or if your RDBMS does not natively support offsets, this is
emulated with a ROW_NUMBER()
window function and nested
SELECT
statements.
@Support void addLimit(int numberOfRows)
This is the same as calling addLimit(int, int)
with offset = 0
numberOfRows
- The number of rows to return@Support(value={CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,SYBASE,VERTICA}) void addLimit(Param<java.lang.Integer> numberOfRows)
Note that some dialects do not support bind values at all in
LIMIT
or TOP
clauses!
If there is no LIMIT
or TOP
clause in your
RDBMS, or the LIMIT
or TOP
clause does not
support bind values, this may be emulated with a
ROW_NUMBER()
window function and nested SELECT
statements.
This is the same as calling addLimit(int, int)
with offset = 0
numberOfRows
- The number of rows to return@Support(value={CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,SYBASE,VERTICA}) void addLimit(int offset, int numberOfRows)
Note that some dialects do not support bind values at all in
LIMIT
or TOP
clauses!
If there is no LIMIT
or TOP
clause in your
RDBMS, or if your RDBMS does not natively support offsets, this is
emulated with a ROW_NUMBER()
window function and nested
SELECT
statements.
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return@Support(value={CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,SYBASE,VERTICA}) void addLimit(Param<java.lang.Integer> offset, int numberOfRows)
Note that some dialects do not support bind values at all in
LIMIT
or TOP
clauses!
If there is no LIMIT
or TOP
clause in your
RDBMS, or the LIMIT
or TOP
clause does not
support bind values, or if your RDBMS does not natively support offsets,
this may be emulated with a ROW_NUMBER()
window function
and nested SELECT
statements.
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return@Support(value={CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,SYBASE,VERTICA}) void addLimit(int offset, Param<java.lang.Integer> numberOfRows)
Note that some dialects do not support bind values at all in
LIMIT
or TOP
clauses!
If there is no LIMIT
or TOP
clause in your
RDBMS, or the LIMIT
or TOP
clause does not
support bind values, or if your RDBMS does not natively support offsets,
this may be emulated with a ROW_NUMBER()
window function
and nested SELECT
statements.
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return@Support(value={CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MYSQL,ORACLE,POSTGRES,SQLITE,SQLSERVER,SYBASE,VERTICA}) void addLimit(Param<java.lang.Integer> offset, Param<java.lang.Integer> numberOfRows)
Note that some dialects do not support bind values at all in
LIMIT
or TOP
clauses!
If there is no LIMIT
or TOP
clause in your
RDBMS, or the LIMIT
or TOP
clause does not
support bind values, or if your RDBMS does not natively support offsets,
this may be emulated with a ROW_NUMBER()
window function
and nested SELECT
statements.
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return@Support(value={CUBRID,DB2,FIREBIRD_3_0,HANA,INFORMIX,MYSQL_8_0,POSTGRES,ORACLE,REDSHIFT,SQLSERVER,SYBASE,VERTICA}) void setWithTies(boolean withTies)
WITH TIES
clause to a LIMIT
clause.@Support(value={ASE,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MYSQL,ORACLE,POSTGRES,SQLSERVER,SYBASE}) void setForUpdate(boolean forUpdate)
This has been observed to be supported by any of these dialects:
These dialects can emulate the FOR UPDATE
clause using a
cursor. The cursor is handled by the JDBC driver, at
PreparedStatement
construction time, when calling
Connection.prepareStatement(String, int, int)
with
ResultSet.CONCUR_UPDATABLE
. jOOQ handles emulation of a
FOR UPDATE
clause using CONCUR_UPDATABLE
for
these dialects:
Note: This emulation may not be efficient for large result sets!
These dialects are known not to support the FOR UPDATE
clause in regular SQL:
If your dialect does not support this clause, jOOQ will still render it, if you apply it to your query. This might then cause syntax errors reported either by your database or your JDBC driver.
You shouldn't combine this with setForShare(boolean)
forUpdate
- The flag's value@Support(value={DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,SYBASE}) void setForUpdateOf(Field<?>... fields)
FOR UPDATE
clause, instead of the full row.
This automatically sets the setForUpdate(boolean)
flag, and
unsets the setForShare(boolean)
flag, if it was previously set.
This has been observed to be natively supported by any of these dialects:
Note, that SQLDialect.DB2
has some stricter requirements
regarding the updatability of fields. Refer to the DB2 documentation for
further details
fields
- The fields that should be locked@Support(value={DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,SYBASE}) void setForUpdateOf(java.util.Collection<? extends Field<?>> fields)
FOR UPDATE
clause, instead of the full row.
setForUpdateOf(Field...)
@Support(value={DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MYSQL_8_0,POSTGRES,ORACLE,SYBASE}) void setForUpdateOf(Table<?>... tables)
FOR UPDATE
clause, instead of the full row.
This automatically sets the setForUpdate(boolean)
flag, and
unsets the setForShare(boolean)
flag, if it was previously set.
This has been observed to be natively supported by any of these dialects:
jOOQ emulates this by locking all known fields of [tables
]
for any of these dialects:
tables
- The tables that should be locked@Support(value=ORACLE) void setForUpdateWait(int seconds)
FOR UPDATE
clause. In this case, the session will wait for
some seconds
, before aborting the lock acquirement if the
lock is not available.
This automatically sets the setForUpdate(boolean)
flag, and
unsets the setForShare(boolean)
flag, if it was previously set.
This has been observed to be supported by any of these dialects:
seconds
- The number of seconds to wait for a lock@Support(value={MYSQL_8_0,ORACLE,POSTGRES}) void setForUpdateNoWait()
FOR UPDATE
clause. In this case, the session will not wait
before aborting the lock acquirement if the lock is not available.
This automatically sets the setForUpdate(boolean)
flag, and
unsets the setForShare(boolean)
flag, if it was previously set.
This has been observed to be supported by any of these dialects:
@Support(value={MYSQL_8_0,ORACLE,POSTGRES_9_5}) void setForUpdateSkipLocked()
FOR UPDATE
clause. In this case, the session will skip all
locked rows from the select statement, whose lock is not available.
This automatically sets the setForUpdate(boolean)
flag, and
unsets the setForShare(boolean)
flag, if it was previously set.
This has been observed to be supported by any of these dialects:
@Support(value={MARIADB,MYSQL,POSTGRES}) void setForShare(boolean forShare)
This has been observed to be supported by any of these dialects:
If your dialect does not support this clause, jOOQ will still render it, if you apply it to your query. This might then cause syntax errors reported either by your database or your JDBC driver.
You shouldn't combine this with setForUpdate(boolean)
forShare
- The flag's value@Support(value=ORACLE) void setWithCheckOption()
WITH CHECK OPTION
clause to the end of the subquery.Copyright © 2018. All Rights Reserved.