|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.engine.DbObjectBase
org.h2.schema.SchemaObjectBase
org.h2.schema.Sequence
public class Sequence
A sequence is created using the statement CREATE SEQUENCE
Field Summary | |
---|---|
static int |
DEFAULT_CACHE_SIZE
The default cache size for sequences. |
Fields inherited from class org.h2.engine.DbObjectBase |
---|
comment, database, trace |
Fields inherited from interface org.h2.engine.DbObject |
---|
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE |
Constructor Summary | |
---|---|
Sequence(Schema schema,
int id,
java.lang.String name,
long startValue,
long increment)
Creates a new sequence for an auto-increment column. |
|
Sequence(Schema schema,
int id,
java.lang.String name,
java.lang.Long startValue,
java.lang.Long increment,
java.lang.Long cacheSize,
java.lang.Long minValue,
java.lang.Long maxValue,
boolean cycle,
boolean belongsToTable)
Creates a new sequence. |
Method Summary | |
---|---|
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()
|
java.lang.String |
getDropSQL()
Build a SQL statement to drop this object. |
long |
getIncrement()
|
long |
getMaxValue()
|
long |
getMinValue()
|
long |
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)
|
Methods inherited from class org.h2.schema.SchemaObjectBase |
---|
getSchema, getSQL, initSchemaObjectBase, isHidden |
Methods inherited from class org.h2.engine.DbObjectBase |
---|
getChildren, getComment, getDatabase, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, rename, setComment, setModified, setObjectName, setTemporary, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.h2.engine.DbObject |
---|
getChildren, getComment, getDatabase, getId, getName, isTemporary, rename, setComment, setTemporary |
Field Detail |
---|
public static final int DEFAULT_CACHE_SIZE
Constructor Detail |
---|
public Sequence(Schema schema, int id, java.lang.String name, long startValue, long increment)
schema
- the schemaid
- the object idname
- the sequence namestartValue
- the first value to returnincrement
- the increment countpublic Sequence(Schema schema, int id, java.lang.String name, java.lang.Long startValue, java.lang.Long increment, java.lang.Long cacheSize, java.lang.Long minValue, java.lang.Long maxValue, boolean cycle, boolean belongsToTable)
schema
- the schemaid
- the object idname
- the sequence namestartValue
- the first value to returnincrement
- the increment countcacheSize
- the number of entries to pre-fetchminValue
- the minimum valuemaxValue
- the maximum valuecycle
- whether to jump back to the min value if neededbelongsToTable
- whether this sequence belongs to a table (for
auto-increment columns)Method Detail |
---|
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 boolean getBelongsToTable()
public long getIncrement()
public long getMinValue()
public long getMaxValue()
public boolean getCycle()
public void setCycle(boolean cycle)
public java.lang.String getDropSQL()
DbObjectBase
getDropSQL
in interface DbObject
getDropSQL
in class DbObjectBase
public java.lang.String getCreateSQLForCopy(Table table, java.lang.String quotedName)
DbObject
table
- the new tablequotedName
- the quoted name
public java.lang.String getCreateSQL()
DbObjectBase
getCreateSQL
in interface DbObject
getCreateSQL
in class DbObjectBase
public long getNext(Session session)
session
- the session
public void flushWithoutMargin()
public void flush(Session session)
session
- the sessionpublic void close()
public int getType()
DbObject
public void removeChildrenAndResources(Session session)
DbObjectBase
removeChildrenAndResources
in interface DbObject
removeChildrenAndResources
in class DbObjectBase
session
- the sessionpublic void checkRename()
DbObjectBase
checkRename
in interface DbObject
checkRename
in class DbObjectBase
public long getCurrentValue()
public void setBelongsToTable(boolean b)
public void setCacheSize(long cacheSize)
public long getCacheSize()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |