|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.sql.execute.AutoincrementCounter
public class AutoincrementCounter
AutoincrementCounter is a not so general counter for the specific purposes of autoincrement columns. It can be thought of as an in-memory autoincrement column. The counting or incrementing is done in fashion identical to the AUTOINCREMENTVALUE in SYSCOLUMNS.
To create a counter, the user must call the constructor with a start value, increment and optionally a final value. In addition the caller must specify the schema name, table name and column name uniquely identifying the counter.
When a counter is created it is in an invalid state-- to initialize it, the user must call either update or reset(false). The value of a counter can be changed by either calling reset or update.
| Field Summary | |
|---|---|
private java.lang.String |
columnName
|
private int |
columnPosition
|
private long |
counter
|
private long |
finalValue
|
private java.lang.String |
identity
|
private long |
increment
|
private boolean |
initialized
|
private java.lang.String |
schemaName
|
private java.lang.Long |
start
|
private java.lang.String |
tableName
|
| Constructor Summary | |
|---|---|
AutoincrementCounter(java.lang.Long start,
long increment,
long finalValue,
java.lang.String s,
java.lang.String t,
java.lang.String c,
int position)
constructor |
|
| Method Summary | |
|---|---|
void |
flushToDisk(TransactionController tc,
DataDictionary dd,
UUID tableUUID)
flush a counter to disk; i.e write the current value of the counter into the row in SYSCOLUMNS. |
int |
getColumnPosition()
get the column position in the table for which this counter has been created. |
java.lang.Long |
getCurrentValue()
get the current value of the counter. |
java.lang.String |
getIdentity()
return the identity of the counter. |
java.lang.Long |
getStartValue()
get the start value |
static java.lang.String |
makeIdentity(java.lang.String s,
java.lang.String t,
java.lang.String c)
make a unique key for the counter. |
static java.lang.String |
makeIdentity(TableDescriptor td,
ColumnDescriptor cd)
make a unique key for the counter. |
void |
reset(boolean begin)
reset to the counter to the beginning or the end. |
java.lang.String |
toString()
|
long |
update()
update the counter to its next value. |
long |
update(long t)
update the counter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.lang.Long start
private long increment
private java.lang.String identity
private long finalValue
private java.lang.String schemaName
private java.lang.String tableName
private java.lang.String columnName
private long counter
private int columnPosition
private boolean initialized
| Constructor Detail |
|---|
public AutoincrementCounter(java.lang.Long start,
long increment,
long finalValue,
java.lang.String s,
java.lang.String t,
java.lang.String c,
int position)
start - The start value of the counter; is a java object as
it can also be null.increment - how much to increment the counter by.finalValue - the finalvalue of the counter. used by resets - t - c - | Method Detail |
|---|
public static java.lang.String makeIdentity(java.lang.String s,
java.lang.String t,
java.lang.String c)
public static java.lang.String makeIdentity(TableDescriptor td,
ColumnDescriptor cd)
public void reset(boolean begin)
begin - if TRUE reset to beginning and mark it uninitialized.public long update(long t)
t - update the counter to this value.
public long update()
throws StandardException
StandardException - if the counter has not yet been
initialized and the Start value is NULL.public java.lang.Long getCurrentValue()
public java.lang.String getIdentity()
public void flushToDisk(TransactionController tc,
DataDictionary dd,
UUID tableUUID)
throws StandardException
tc - TransactionController to usedd - DataDictionary to use.tableUUID - I might have the table name but I need more
information
StandardException - standard Derby exception.public int getColumnPosition()
public java.lang.Long getStartValue()
public java.lang.String toString()
toString in class java.lang.Object
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||