public class SQLServer2012SequenceHandler extends SequenceHandler
Important notes:
NEXT-VALUE
is the natural NEXT (crt + inc)
;
NEXT
value to be returned by NEXT-VALUE
.
After the fist NEXT-VALUE
, the CURRENT-VALUE
is unchanged!
MAX_VALUE
to MIN_VALUE
(and the reverse);
MAX_VALUE
back to INITIAL_VALUE
instead.
Modifier and Type | Field and Description |
---|---|
private boolean |
ignoreNextToLowBoundAdjustment
When the sequence is set to a new value, SQL2012 requires a NEXT value to be performed.
|
private static java.util.logging.Logger |
LOG
J2SE Logger.
|
private java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> |
sequences
The list of sequences grouped by databases.
|
Constructor and Description |
---|
SQLServer2012SequenceHandler(java.lang.String ldbName)
The only constructor takes the name of the database as argument.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
safeContains(java.lang.String seqName,
java.lang.String ldbName)
Test whether the database contains a sequence.
|
protected int64 |
safeGetCurrentValue(java.lang.String seqName,
java.lang.String ldbName)
Queries the current value of a sequence.
|
protected int64 |
safeGetNextValue(java.lang.String seqName,
java.lang.String ldbName)
Computes and returns the next value of a sequence.
|
protected void |
safeSetValue(java.lang.String seqName,
java.lang.String ldbName,
long newVal)
Initialize (reset) the current value of a sequence.
|
contains, getCurrentValue, getNextValue, getResultValue, setValue
private static final java.util.logging.Logger LOG
private java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> sequences
private boolean ignoreNextToLowBoundAdjustment
public SQLServer2012SequenceHandler(java.lang.String ldbName)
ldbName
- The database logical name on which this handler will work with.protected int64 safeGetCurrentValue(java.lang.String seqName, java.lang.String ldbName)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeGetCurrentValue
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to. It is assumed it is not null and
valid.protected int64 safeGetNextValue(java.lang.String seqName, java.lang.String ldbName)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeGetNextValue
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to. It is assumed it is not null and
valid.protected void safeSetValue(java.lang.String seqName, java.lang.String ldbName, long newVal)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeSetValue
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to.
It is assumed it is not null and valid.newVal
- The value the sequence will be reset to.protected boolean safeContains(java.lang.String seqName, java.lang.String ldbName)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeContains
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to. If is null then the first connected
database is assumed.