[#3389] Add DSLContext.currval(String) and nextval(String) for convenience
This commit is contained in:
parent
459317cb0e
commit
c742587add
@ -4790,7 +4790,16 @@ public interface DSLContext {
|
||||
|
||||
/**
|
||||
* Convenience method to fetch the NEXTVAL for a sequence directly from this
|
||||
* {@link DSLContext}'s underlying JDBC {@link Connection}
|
||||
* {@link DSLContext}'s underlying JDBC {@link Connection}.
|
||||
*
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES })
|
||||
BigInteger nextval(String sequence) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Convenience method to fetch the NEXTVAL for a sequence directly from this
|
||||
* {@link DSLContext}'s underlying JDBC {@link Connection}.
|
||||
*
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@ -4799,7 +4808,16 @@ public interface DSLContext {
|
||||
|
||||
/**
|
||||
* Convenience method to fetch the CURRVAL for a sequence directly from this
|
||||
* {@link DSLContext}'s underlying JDBC {@link Connection}
|
||||
* {@link DSLContext}'s underlying JDBC {@link Connection}.
|
||||
*
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@Support({ CUBRID, FIREBIRD, H2, POSTGRES })
|
||||
BigInteger currval(String sequence) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Convenience method to fetch the CURRVAL for a sequence directly from this
|
||||
* {@link DSLContext}'s underlying JDBC {@link Connection}.
|
||||
*
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
|
||||
@ -1678,12 +1678,22 @@ public class DefaultDSLContext implements DSLContext, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigInteger nextval(String sequence) {
|
||||
return nextval(sequence(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Number> T nextval(Sequence<T> sequence) {
|
||||
Field<T> nextval = sequence.nextval();
|
||||
return select(nextval).fetchOne(nextval);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigInteger currval(String sequence) {
|
||||
return currval(sequence(sequence));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Number> T currval(Sequence<T> sequence) {
|
||||
Field<T> currval = sequence.currval();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user