[#4299] Add support for PostgreSQL 9.5 - FOR UPDATE SKIP LOCKED
This commit is contained in:
parent
1559ac960f
commit
0002c41e89
@ -42,6 +42,7 @@ package org.jooq;
|
||||
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.POSTGRES_9_5;
|
||||
|
||||
/**
|
||||
* This type is used for the {@link Select}'s DSL API when selecting generic
|
||||
@ -109,15 +110,13 @@ public interface SelectForUpdateWaitStep<R extends Record> extends SelectOptionS
|
||||
@Support({ POSTGRES })
|
||||
SelectOptionStep<R> noWait();
|
||||
|
||||
/* [pro] xx
|
||||
xxx
|
||||
x xxx x xxxxxxxxxxxxxxxxx xxxxxx xx xxx xxxxxxxxx xxxxxxxxxxxxx xxxxxx xx
|
||||
x xxx xxx xx xxx xxxxxx
|
||||
x
|
||||
x xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxx xxxxxxxxxxxx xxx xxxx
|
||||
x xxxxxxx
|
||||
xx
|
||||
xxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
|
||||
xx [/pro] */
|
||||
/**
|
||||
* Add a <code>WAIT</code> clause to the <code>FOR UPDATE</code> clause at
|
||||
* the end of the query.
|
||||
*
|
||||
* @see SelectQuery#setForUpdateSkipLocked() see LockProvider for more
|
||||
* details
|
||||
*/
|
||||
@Support({ POSTGRES_9_5 })
|
||||
SelectOptionStep<R> skipLocked();
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.POSTGRES_9_5;
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
@ -788,24 +789,22 @@ public interface SelectQuery<R extends Record> extends Select<R>, ConditionProvi
|
||||
@Support({ POSTGRES })
|
||||
void setForUpdateNoWait();
|
||||
|
||||
/* [pro] xx
|
||||
xxx
|
||||
x xxxx xxxxx xxxxx xxx xxxxxxxxxx xxx xxxxxxx xxxx xxx xxx xxxxxxx
|
||||
x xxxxxxxxx xxxxxxxxxxxxx xxxxxxx xx xxxx xxxxx xxx xxxxxxx xxxx xxxx xxx
|
||||
x xxxxxx xxxx xxxx xxx xxxxxx xxxxxxxxxx xxxxx xxxx xx xxx xxxxxxxxxx
|
||||
x xxx
|
||||
x xxxx xxxxxxxxxxxxx xxxx xxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxx xxx
|
||||
x xxxxxx xxx xxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxx xx xx xxx xxxxxxxxxx xxxx
|
||||
x xxx
|
||||
x xxxx xxx xxxx xxxxxxxx xx xx xxxxxxxxx xx xxx xx xxxxx xxxxxxxxx
|
||||
x xxxx
|
||||
x xxxxxxxxxxxxxxx
|
||||
x xxxxx
|
||||
xx
|
||||
xxxxxxxxxxxxxxxx
|
||||
xxxx xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
/**
|
||||
* Some RDBMS allow for specifying the locking mode for the applied
|
||||
* <code>FOR UPDATE</code> clause. In this case, the session will skip all
|
||||
* locked rows from the select statement, whose lock is not available.
|
||||
* <p>
|
||||
* This automatically sets the {@link #setForUpdate(boolean)} flag, and
|
||||
* unsets the {@link #setForShare(boolean)} flag, if it was previously set.
|
||||
* <p>
|
||||
* This has been observed to be supported by any of these dialects:
|
||||
* <ul>
|
||||
* <li>Oracle</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Support({POSTGRES_9_5})
|
||||
void setForUpdateSkipLocked();
|
||||
|
||||
xx [/pro] */
|
||||
/**
|
||||
* Sets the "FOR SHARE" flag onto the query.
|
||||
* <p>
|
||||
|
||||
@ -1874,14 +1874,12 @@ class SelectImpl<R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
|
||||
return this;
|
||||
}
|
||||
|
||||
/* [pro] xx
|
||||
xxxxxxxxx
|
||||
xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxx x
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxx xxxxx
|
||||
x
|
||||
@Override
|
||||
public final SelectImpl skipLocked() {
|
||||
getQuery().setForUpdateSkipLocked();
|
||||
return this;
|
||||
}
|
||||
|
||||
xx [/pro] */
|
||||
@Override
|
||||
public final SelectImpl forShare() {
|
||||
getQuery().setForShare(true);
|
||||
|
||||
@ -1512,14 +1512,12 @@ class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> implement
|
||||
forUpdateWait = 0;
|
||||
}
|
||||
|
||||
/* [pro] xx
|
||||
xxxxxxxxx
|
||||
xxxxxx xxxxx xxxx xxxxxxxxxxxxxxxxxxxxxxxx x
|
||||
xxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
xxxxxxxxxxxxx x xx
|
||||
x
|
||||
xx [/pro] */
|
||||
@Override
|
||||
public final void setForUpdateSkipLocked() {
|
||||
setForUpdate(true);
|
||||
forUpdateMode = ForUpdateMode.SKIP_LOCKED;
|
||||
forUpdateWait = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setForShare(boolean forShare) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user