Package org.h2.command.ddl
Class SequenceOptions
- java.lang.Object
-
- org.h2.command.ddl.SequenceOptions
-
public class SequenceOptions extends java.lang.ObjectSequence options.
-
-
Field Summary
Fields Modifier and Type Field Description private long[]boundsprivate ExpressioncacheSizeprivate Sequence.Cyclecycleprivate TypeInfodataTypeprivate Expressionincrementprivate ExpressionmaxValueprivate ExpressionminValueprivate SequenceoldSequenceprivate Expressionrestartprivate Expressionstart
-
Constructor Summary
Constructors Constructor Description SequenceOptions()Creates new instance of sequence options.SequenceOptions(Sequence oldSequence, TypeInfo dataType)Creates new instance of sequence options.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.Longcheck(java.lang.Long value)private voidcopyFromOldSequence()long[]getBounds()static long[]getBounds(TypeInfo dataType)Get the bounds (min, max) of a data type.java.lang.LonggetCacheSize(SessionLocal session)Gets cache size.private longgetCurrentStart(Sequence sequence, SessionLocal session)Sequence.CyclegetCycle()Gets cycle option.TypeInfogetDataType()java.lang.LonggetIncrement(SessionLocal session)Gets increment value.private static java.lang.LonggetLong(SessionLocal session, Expression expr)java.lang.LonggetMaxValue(Sequence sequence, SessionLocal session)Gets max value.java.lang.LonggetMinValue(Sequence sequence, SessionLocal session)Gets min value.java.lang.LonggetRestartValue(SessionLocal session, long startValue)Gets restart value.java.lang.LonggetStartValue(SessionLocal session)Gets start value.voidsetCacheSize(Expression cacheSize)Sets cache size.voidsetCycle(Sequence.Cycle cycle)Sets cycle option.voidsetDataType(TypeInfo dataType)voidsetIncrement(Expression increment)Sets increment value expression.voidsetMaxValue(Expression maxValue)Sets max value expression.voidsetMinValue(Expression minValue)Sets min value expression.voidsetRestartValue(Expression restart)Sets restart value expression, orValueExpression.DEFAULT.voidsetStartValue(Expression start)Sets start value expression.
-
-
-
Field Detail
-
dataType
private TypeInfo dataType
-
start
private Expression start
-
restart
private Expression restart
-
increment
private Expression increment
-
maxValue
private Expression maxValue
-
minValue
private Expression minValue
-
cycle
private Sequence.Cycle cycle
-
cacheSize
private Expression cacheSize
-
bounds
private long[] bounds
-
oldSequence
private final Sequence oldSequence
-
-
Method Detail
-
getLong
private static java.lang.Long getLong(SessionLocal session, Expression expr)
-
getDataType
public TypeInfo getDataType()
-
copyFromOldSequence
private void copyFromOldSequence()
-
setDataType
public void setDataType(TypeInfo dataType)
-
getStartValue
public java.lang.Long getStartValue(SessionLocal session)
Gets start value.- Parameters:
session- The session to calculate the value.- Returns:
- start value or
nullif value is not defined.
-
setStartValue
public void setStartValue(Expression start)
Sets start value expression.- Parameters:
start- START WITH value expression.
-
getRestartValue
public java.lang.Long getRestartValue(SessionLocal session, long startValue)
Gets restart value.- Parameters:
session- the session to calculate the valuestartValue- the start value to use if restart without value is specified- Returns:
- restart value or
nullif value is not defined.
-
setRestartValue
public void setRestartValue(Expression restart)
Sets restart value expression, orValueExpression.DEFAULT.- Parameters:
restart- RESTART WITH value expression, orValueExpression.DEFAULTfor simple RESTART
-
getIncrement
public java.lang.Long getIncrement(SessionLocal session)
Gets increment value.- Parameters:
session- The session to calculate the value.- Returns:
- increment value or
nullif value is not defined.
-
setIncrement
public void setIncrement(Expression increment)
Sets increment value expression.- Parameters:
increment- INCREMENT BY value expression.
-
getMaxValue
public java.lang.Long getMaxValue(Sequence sequence, SessionLocal session)
Gets max value.- Parameters:
sequence- the sequence to get default max value.session- The session to calculate the value.- Returns:
- max value when the MAXVALUE expression is set, otherwise returns default max value.
-
setMaxValue
public void setMaxValue(Expression maxValue)
Sets max value expression.- Parameters:
maxValue- MAXVALUE expression.
-
getMinValue
public java.lang.Long getMinValue(Sequence sequence, SessionLocal session)
Gets min value.- Parameters:
sequence- the sequence to get default min value.session- The session to calculate the value.- Returns:
- min value when the MINVALUE expression is set, otherwise returns default min value.
-
setMinValue
public void setMinValue(Expression minValue)
Sets min value expression.- Parameters:
minValue- MINVALUE expression.
-
check
private java.lang.Long check(java.lang.Long value)
-
getBounds
public long[] getBounds()
-
getBounds
public static long[] getBounds(TypeInfo dataType)
Get the bounds (min, max) of a data type.- Parameters:
dataType- the data type- Returns:
- the bounds (an array with 2 elements)
-
getCycle
public Sequence.Cycle getCycle()
Gets cycle option.- Returns:
- cycle option value or
nullif is not defined.
-
setCycle
public void setCycle(Sequence.Cycle cycle)
Sets cycle option.- Parameters:
cycle- option value.
-
getCacheSize
public java.lang.Long getCacheSize(SessionLocal session)
Gets cache size.- Parameters:
session- The session to calculate the value.- Returns:
- cache size or
nullif value is not defined.
-
setCacheSize
public void setCacheSize(Expression cacheSize)
Sets cache size.- Parameters:
cacheSize- cache size.
-
getCurrentStart
private long getCurrentStart(Sequence sequence, SessionLocal session)
-
-