public class Sequence extends SchemaObjectBase
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CACHE_SIZE
The default cache size for sequences.
|
comment, database, trace| Constructor and Description |
|---|
Sequence(Session session,
Schema schema,
int id,
java.lang.String name,
SequenceOptions options,
boolean belongsToTable)
Creates a new sequence.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkRename()
Check if this object can be renamed.
|
void |
close()
Flush the current value to disk and close this object.
|
void |
flush(Session session)
Flush the current value, including the margin, to disk.
|
void |
flushWithoutMargin()
Flush the current value to disk.
|
boolean |
getBelongsToTable() |
long |
getCacheSize() |
java.lang.String |
getCreateSQL()
Build a SQL statement to re-create this object.
|
java.lang.String |
getCreateSQLForCopy(Table table,
java.lang.String quotedName)
Build a SQL statement to re-create the object, or to create a copy of the
object with a different name or referencing a different table
|
long |
getCurrentValue() |
boolean |
getCycle() |
static long |
getDefaultMaxValue(java.lang.Long startValue,
long increment)
Calculates default max value.
|
static long |
getDefaultMinValue(java.lang.Long startValue,
long increment)
Calculates default min value.
|
java.lang.String |
getDropSQL()
Build a SQL statement to drop this object.
|
long |
getIncrement() |
long |
getMaxValue() |
long |
getMinValue() |
Value |
getNext(Session session)
Get the next value for this sequence.
|
int |
getType()
Get the object type.
|
void |
modify(java.lang.Long startValue,
java.lang.Long minValue,
java.lang.Long maxValue,
java.lang.Long increment)
Allows the start value, increment, min value and max value to be updated
atomically, including atomic validation.
|
void |
removeChildrenAndResources(Session session)
Remove all dependent objects and free all resources (files, blocks in
files) of this object.
|
void |
setBelongsToTable(boolean b) |
void |
setCacheSize(long cacheSize) |
void |
setCycle(boolean cycle) |
getSchema, getSQL, getSQL, isHiddengetChildren, getComment, getDatabase, getId, getModificationId, getName, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChildren, getComment, getDatabase, getId, getName, isTemporary, rename, setComment, setTemporarypublic static final int DEFAULT_CACHE_SIZE
public Sequence(Session 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
auto-increment columns)public void modify(java.lang.Long startValue,
java.lang.Long minValue,
java.lang.Long maxValue,
java.lang.Long increment)
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)public static long getDefaultMinValue(java.lang.Long startValue,
long increment)
startValue - the start value of the sequence.increment - the increment of the sequence value.public static long getDefaultMaxValue(java.lang.Long startValue,
long increment)
startValue - the start value of the sequence.increment - the increment of the sequence value.public boolean getBelongsToTable()
public long getIncrement()
public long getMinValue()
public long getMaxValue()
public boolean getCycle()
public void setCycle(boolean cycle)
public java.lang.String getDropSQL()
DbObjectBasegetDropSQL in interface DbObjectgetDropSQL in class DbObjectBasepublic java.lang.String getCreateSQLForCopy(Table table, java.lang.String quotedName)
DbObjecttable - the new tablequotedName - the quoted namepublic java.lang.String getCreateSQL()
DbObjectBasegetCreateSQL in interface DbObjectgetCreateSQL in class DbObjectBasepublic Value getNext(Session session)
session - the sessionpublic void flushWithoutMargin()
public void flush(Session session)
session - the sessionpublic void close()
public int getType()
DbObjectpublic void removeChildrenAndResources(Session session)
DbObjectBaseremoveChildrenAndResources in interface DbObjectremoveChildrenAndResources in class DbObjectBasesession - the sessionpublic void checkRename()
DbObjectBasecheckRename in interface DbObjectcheckRename in class DbObjectBasepublic long getCurrentValue()
public void setBelongsToTable(boolean b)
public void setCacheSize(long cacheSize)
public long getCacheSize()