public final class Sequence extends SchemaObject
| Modifier and Type | Class and Description |
|---|---|
static class |
Sequence.Cycle
CYCLE clause and sequence state.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CACHE_SIZE
The default cache size for sequences.
|
AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USERADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS| Constructor and Description |
|---|
Sequence(SessionLocal session,
Schema schema,
int id,
java.lang.String name,
SequenceOptions options,
boolean belongsToTable)
Creates a new sequence.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Flush the current value to disk and close this object.
|
void |
flush(SessionLocal session)
Flush the current value, including the margin, to disk.
|
void |
flushWithoutMargin()
Flush the current value to disk.
|
long |
getBaseValue() |
boolean |
getBelongsToTable() |
long |
getCacheSize() |
java.lang.String |
getCreateSQL()
Construct the CREATE ...
|
long |
getCurrentValue() |
Sequence.Cycle |
getCycle() |
TypeInfo |
getDataType() |
static long |
getDefaultMaxValue(java.lang.Long startValue,
long increment,
long[] bounds)
Calculates default max value.
|
static long |
getDefaultMinValue(java.lang.Long startValue,
long increment,
long[] bounds)
Calculates default min value.
|
java.lang.String |
getDropSQL()
Construct a DROP ...
|
int |
getEffectivePrecision() |
long |
getIncrement() |
long |
getMaxValue() |
long |
getMinValue() |
Value |
getNext(SessionLocal session)
Get the next value for this sequence.
|
java.lang.StringBuilder |
getSequenceOptionsSQL(java.lang.StringBuilder builder)
Append the options part of the SQL statement to create the sequence.
|
long |
getStartValue() |
int |
getType()
Get the object type.
|
void |
modify(java.lang.Long baseValue,
java.lang.Long startValue,
java.lang.Long minValue,
java.lang.Long maxValue,
java.lang.Long increment,
Sequence.Cycle cycle,
java.lang.Long cacheSize)
Allows the base value, start value, min value, max value, increment and
cache size to be updated atomically, including atomic validation.
|
void |
removeChildrenAndResources(SessionLocal session)
Delete all dependent children objects and resources of this object.
|
void |
setBelongsToTable(boolean b) |
getSchema, getSQL, getSQL, isHiddencheckRename, getChildren, getComment, getCreateSQLForCopy, getCreateSQLForMeta, getDatabase, getId, getModificationId, getName, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTraceSQLpublic static final int DEFAULT_CACHE_SIZE
public Sequence(SessionLocal session, Schema schema, int id, java.lang.String name, SequenceOptions options, boolean belongsToTable)
session - the sessionschema - the schemaid - the object idname - the sequence nameoptions - the sequence optionsbelongsToTable - whether this sequence belongs to a table (for generated
columns)public void modify(java.lang.Long baseValue,
java.lang.Long startValue,
java.lang.Long minValue,
java.lang.Long maxValue,
java.lang.Long increment,
Sequence.Cycle cycle,
java.lang.Long cacheSize)
baseValue - the base value (null if restart is not requested)startValue - the new start value (null if no change)minValue - the new min value (null if no change)maxValue - the new max value (null if no change)increment - the new increment (null if no change)cycle - the new cycle value, or null if no changecacheSize - the new cache size (null if no change)public static long getDefaultMinValue(java.lang.Long startValue,
long increment,
long[] bounds)
startValue - the start value of the sequence.increment - the increment of the sequence value.bounds - min and max bounds of data type of the sequencepublic static long getDefaultMaxValue(java.lang.Long startValue,
long increment,
long[] bounds)
startValue - the start value of the sequence.increment - the increment of the sequence value.bounds - min and max bounds of data type of the sequencepublic boolean getBelongsToTable()
public TypeInfo getDataType()
public int getEffectivePrecision()
public long getIncrement()
public long getStartValue()
public long getMinValue()
public long getMaxValue()
public Sequence.Cycle getCycle()
public java.lang.String getDropSQL()
DbObjectgetDropSQL in class DbObjectpublic java.lang.String getCreateSQL()
DbObjectgetCreateSQL in class DbObjectpublic java.lang.StringBuilder getSequenceOptionsSQL(java.lang.StringBuilder builder)
builder - the builderpublic Value getNext(SessionLocal session)
SessionLocal.getNextValueFor(Sequence, org.h2.command.Prepared) instead.session - the sessionpublic void flushWithoutMargin()
public void flush(SessionLocal session)
session - the sessionpublic void close()
public int getType()
DbObjectpublic void removeChildrenAndResources(SessionLocal session)
DbObjectremoveChildrenAndResources in class DbObjectsession - the sessionpublic long getBaseValue()
public long getCurrentValue()
public void setBelongsToTable(boolean b)
public long getCacheSize()