[#7873] Add HSQLDB support for Sequence.currval()

This commit is contained in:
Lukas Eder 2018-09-20 11:46:53 +02:00
parent 8724415b0e
commit 5e2b01ff47
3 changed files with 10 additions and 10 deletions

View File

@ -9927,7 +9927,7 @@ public interface DSLContext extends Scope , AutoCloseable {
*
* @throws DataAccessException if something went wrong executing the query
*/
@Support({ CUBRID, FIREBIRD, H2, POSTGRES })
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, POSTGRES })
BigInteger currval(String sequence) throws DataAccessException;
/**
@ -9936,7 +9936,7 @@ public interface DSLContext extends Scope , AutoCloseable {
*
* @throws DataAccessException if something went wrong executing the query
*/
@Support({ CUBRID, FIREBIRD, H2, POSTGRES })
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, POSTGRES })
BigInteger currval(Name sequence) throws DataAccessException;
/**
@ -9945,7 +9945,7 @@ public interface DSLContext extends Scope , AutoCloseable {
*
* @throws DataAccessException if something went wrong executing the query
*/
@Support({ CUBRID, FIREBIRD, H2, POSTGRES })
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, POSTGRES })
<T extends Number> T currval(Sequence<T> sequence) throws DataAccessException;
// -------------------------------------------------------------------------

View File

@ -77,7 +77,7 @@ public interface Sequence<T extends Number> extends Named {
/**
* Get the current value of this sequence
*/
@Support({ CUBRID, FIREBIRD, H2, POSTGRES })
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, POSTGRES })
Field<T> currval();
/**

View File

@ -41,6 +41,7 @@ import static org.jooq.Clause.SEQUENCE;
import static org.jooq.Clause.SEQUENCE_REFERENCE;
import static org.jooq.SQLDialect.CUBRID;
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.HSQLDB;
// ...
import static org.jooq.impl.DSL.inline;
import static org.jooq.impl.DSL.select;
@ -162,13 +163,12 @@ public class SequenceImpl<T extends Number> extends AbstractNamed implements Seq
case FIREBIRD:
case DERBY:
case HSQLDB: {
if ("nextval".equals(method)) {
String field = "next value for " + getQualifiedName(configuration);
return DSL.field(field, getDataType());
}
else if (family == FIREBIRD) {
if ("nextval".equals(method))
return DSL.field("next value for " + getQualifiedName(configuration), getDataType());
else if (family == HSQLDB)
return DSL.field("current value for " + getQualifiedName(configuration), getDataType());
else if (family == FIREBIRD)
return DSL.field("gen_id(" + getQualifiedName(configuration) + ", 0)", getDataType());
}