Package org.h2.command.ddl
Class SequenceOptions
java.lang.Object
org.h2.command.ddl.SequenceOptions
Sequence options.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long[]
private Expression
private Sequence.Cycle
private TypeInfo
private Expression
private Expression
private Expression
private final Sequence
private Expression
private Expression
-
Constructor Summary
ConstructorsConstructorDescriptionCreates new instance of sequence options.SequenceOptions
(Sequence oldSequence, TypeInfo dataType) Creates new instance of sequence options. -
Method Summary
Modifier and TypeMethodDescriptionprivate Long
private void
long[]
static long[]
Get the bounds (min, max) of a data type.getCacheSize
(SessionLocal session) Gets cache size.private long
getCurrentStart
(Sequence sequence, SessionLocal session) getCycle()
Gets cycle option.getIncrement
(SessionLocal session) Gets increment value.private static Long
getLong
(SessionLocal session, Expression expr) getMaxValue
(Sequence sequence, SessionLocal session) Gets max value.getMinValue
(Sequence sequence, SessionLocal session) Gets min value.getRestartValue
(SessionLocal session, long startValue) Gets restart value.getStartValue
(SessionLocal session) Gets start value.void
setCacheSize
(Expression cacheSize) Sets cache size.void
setCycle
(Sequence.Cycle cycle) Sets cycle option.void
setDataType
(TypeInfo dataType) void
setIncrement
(Expression increment) Sets increment value expression.void
setMaxValue
(Expression maxValue) Sets max value expression.void
setMinValue
(Expression minValue) Sets min value expression.void
setRestartValue
(Expression restart) Sets restart value expression, orValueExpression.DEFAULT
.void
setStartValue
(Expression start) Sets start value expression.
-
Field Details
-
dataType
-
start
-
restart
-
increment
-
maxValue
-
minValue
-
cycle
-
cacheSize
-
bounds
private long[] bounds -
oldSequence
-
-
Constructor Details
-
SequenceOptions
public SequenceOptions()Creates new instance of sequence options. -
SequenceOptions
Creates new instance of sequence options.- Parameters:
oldSequence
- the sequence to copy options fromdataType
- the new data type
-
-
Method Details
-
getLong
-
getDataType
-
copyFromOldSequence
private void copyFromOldSequence() -
setDataType
-
getStartValue
Gets start value.- Parameters:
session
- The session to calculate the value.- Returns:
- start value or
null
if value is not defined.
-
setStartValue
Sets start value expression.- Parameters:
start
- START WITH value expression.
-
getRestartValue
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
null
if value is not defined.
-
setRestartValue
Sets restart value expression, orValueExpression.DEFAULT
.- Parameters:
restart
- RESTART WITH value expression, orValueExpression.DEFAULT
for simple RESTART
-
getIncrement
Gets increment value.- Parameters:
session
- The session to calculate the value.- Returns:
- increment value or
null
if value is not defined.
-
setIncrement
Sets increment value expression.- Parameters:
increment
- INCREMENT BY value expression.
-
getMaxValue
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
Sets max value expression.- Parameters:
maxValue
- MAXVALUE expression.
-
getMinValue
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
Sets min value expression.- Parameters:
minValue
- MINVALUE expression.
-
check
-
getBounds
public long[] getBounds() -
getBounds
Get the bounds (min, max) of a data type.- Parameters:
dataType
- the data type- Returns:
- the bounds (an array with 2 elements)
-
getCycle
Gets cycle option.- Returns:
- cycle option value or
null
if is not defined.
-
setCycle
Sets cycle option.- Parameters:
cycle
- option value.
-
getCacheSize
Gets cache size.- Parameters:
session
- The session to calculate the value.- Returns:
- cache size or
null
if value is not defined.
-
setCacheSize
Sets cache size.- Parameters:
cacheSize
- cache size.
-
getCurrentStart
-