Top Description Fields Constructors Methods
org.h2.command.ddl

public Class SequenceOptions

extends Object
Class Inheritance
Imports
org.h2.api.ErrorCode, org.h2.engine.SessionLocal, org.h2.expression.Expression, .ValueExpression, org.h2.message.DbException, org.h2.schema.Sequence, org.h2.value.TypeInfo, .Value, .ValueBigint, .ValueNull

Sequence options.

Field Summary

Modifier and TypeField and Description
private long[]
private Expression
private Sequence.Cycle
private TypeInfo
private Expression
private Expression
private Expression
private final Sequence
private Expression
private Expression

Constructor Summary

AccessConstructor and Description
public
SequenceOptions()

Creates new instance of sequence options.

public
SequenceOptions(Sequence
the sequence to copy options from
oldSequence
,
TypeInfo
the new data type
dataType
)

Creates new instance of sequence options.

Method Summary

Modifier and TypeMethod and Description
private Long
check(Long value)

private void
public long[]
public static long[]

Returns:

the bounds (an array with 2 elements)
getBounds
(TypeInfo
the data type
dataType
)

Get the bounds (min, max) of a data type.

public Long

Returns:

cache size or null if value is not defined.
getCacheSize
(SessionLocal
The session to calculate the value.
session
)

Gets cache size.

private long
public Sequence.Cycle

Returns:

cycle option value or null if is not defined.
getCycle
()

Gets cycle option.

public TypeInfo
public Long

Returns:

increment value or null if value is not defined.
getIncrement
(SessionLocal
The session to calculate the value.
session
)

Gets increment value.

private static Long
public Long

Returns:

max value when the MAXVALUE expression is set, otherwise returns default max value.
getMaxValue
(Sequence
the sequence to get default max value.
sequence
,
SessionLocal
The session to calculate the value.
session
)

Gets max value.

public Long

Returns:

min value when the MINVALUE expression is set, otherwise returns default min value.
getMinValue
(Sequence
the sequence to get default min value.
sequence
,
SessionLocal
The session to calculate the value.
session
)

Gets min value.

public Long

Returns:

restart value or null if value is not defined.
getRestartValue
(SessionLocal
the session to calculate the value
session
,
long
the start value to use if restart without value is specified
startValue
)

Gets restart value.

public Long

Returns:

start value or null if value is not defined.
getStartValue
(SessionLocal
The session to calculate the value.
session
)

Gets start value.

public void
setCacheSize(Expression
cache size.
cacheSize
)

Sets cache size.

public void
setCycle(Sequence.Cycle
option value.
cycle
)

Sets cycle option.

public void
public void
setIncrement(Expression
INCREMENT BY value expression.
increment
)

Sets increment value expression.

public void
setMaxValue(Expression
MAXVALUE expression.
maxValue
)

Sets max value expression.

public void
setMinValue(Expression
MINVALUE expression.
minValue
)

Sets min value expression.

public void
setRestartValue(Expression
RESTART WITH value expression, or ValueExpression#DEFAULT for simple RESTART
restart
)

Sets restart value expression, or ValueExpression#DEFAULT.

public void
setStartValue(Expression
START WITH value expression.
start
)

Sets start value expression.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

boundsback to summary
private long[] bounds
cacheSizeback to summary
private Expression cacheSize
cycleback to summary
private Sequence.Cycle cycle
dataTypeback to summary
private TypeInfo dataType
incrementback to summary
private Expression increment
maxValueback to summary
private Expression maxValue
minValueback to summary
private Expression minValue
oldSequenceback to summary
private final Sequence oldSequence
restartback to summary
private Expression restart
startback to summary
private Expression start

Constructor Detail

SequenceOptionsback to summary
public SequenceOptions()

Creates new instance of sequence options.

SequenceOptionsback to summary
public SequenceOptions(Sequence oldSequence, TypeInfo dataType)

Creates new instance of sequence options.

Parameters
oldSequence:Sequence

the sequence to copy options from

dataType:TypeInfo

the new data type

Method Detail

checkback to summary
private Long check(Long value)
copyFromOldSequenceback to summary
private void copyFromOldSequence()
getBoundsback to summary
public long[] getBounds()
getBoundsback to summary
public static long[] getBounds(TypeInfo dataType)

Get the bounds (min, max) of a data type.

Parameters
dataType:TypeInfo

the data type

Returns:long[]

the bounds (an array with 2 elements)

getCacheSizeback to summary
public Long getCacheSize(SessionLocal session)

Gets cache size.

Parameters
session:SessionLocal

The session to calculate the value.

Returns:Long

cache size or null if value is not defined.

getCurrentStartback to summary
private long getCurrentStart(Sequence sequence, SessionLocal session)
getCycleback to summary
public Sequence.Cycle getCycle()

Gets cycle option.

Returns:Sequence.Cycle

cycle option value or null if is not defined.

getDataTypeback to summary
public TypeInfo getDataType()
getIncrementback to summary
public Long getIncrement(SessionLocal session)

Gets increment value.

Parameters
session:SessionLocal

The session to calculate the value.

Returns:Long

increment value or null if value is not defined.

getLongback to summary
private static Long getLong(SessionLocal session, Expression expr)
getMaxValueback to summary
public Long getMaxValue(Sequence sequence, SessionLocal session)

Gets max value.

Parameters
sequence:Sequence

the sequence to get default max value.

session:SessionLocal

The session to calculate the value.

Returns:Long

max value when the MAXVALUE expression is set, otherwise returns default max value.

getMinValueback to summary
public Long getMinValue(Sequence sequence, SessionLocal session)

Gets min value.

Parameters
sequence:Sequence

the sequence to get default min value.

session:SessionLocal

The session to calculate the value.

Returns:Long

min value when the MINVALUE expression is set, otherwise returns default min value.

getRestartValueback to summary
public Long getRestartValue(SessionLocal session, long startValue)

Gets restart value.

Parameters
session:SessionLocal

the session to calculate the value

startValue:long

the start value to use if restart without value is specified

Returns:Long

restart value or null if value is not defined.

getStartValueback to summary
public Long getStartValue(SessionLocal session)

Gets start value.

Parameters
session:SessionLocal

The session to calculate the value.

Returns:Long

start value or null if value is not defined.

setCacheSizeback to summary
public void setCacheSize(Expression cacheSize)

Sets cache size.

Parameters
cacheSize:Expression

cache size.

setCycleback to summary
public void setCycle(Sequence.Cycle cycle)

Sets cycle option.

Parameters
cycle:Sequence.Cycle

option value.

setDataTypeback to summary
public void setDataType(TypeInfo dataType)
setIncrementback to summary
public void setIncrement(Expression increment)

Sets increment value expression.

Parameters
increment:Expression

INCREMENT BY value expression.

setMaxValueback to summary
public void setMaxValue(Expression maxValue)

Sets max value expression.

Parameters
maxValue:Expression

MAXVALUE expression.

setMinValueback to summary
public void setMinValue(Expression minValue)

Sets min value expression.

Parameters
minValue:Expression

MINVALUE expression.

setRestartValueback to summary
public void setRestartValue(Expression restart)

Sets restart value expression, or ValueExpression#DEFAULT.

Parameters
restart:Expression

RESTART WITH value expression, or ValueExpression#DEFAULT for simple RESTART

setStartValueback to summary
public void setStartValue(Expression start)

Sets start value expression.

Parameters
start:Expression

START WITH value expression.