|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ execute overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.sql.execute
Class AutoincrementCounter

java.lang.Objectorg.apache.derby.impl.sql.execute.AutoincrementCounter
- public class AutoincrementCounter
- extends java.lang.Object
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(org.apache.derby.iapi.store.access.TransactionController tc,
org.apache.derby.iapi.sql.dictionary.DataDictionary dd,
org.apache.derby.catalog.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(org.apache.derby.iapi.sql.dictionary.TableDescriptor td,
org.apache.derby.iapi.sql.dictionary.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()
Convert this Object to a human-readable String. |
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 |
start
private java.lang.Long start
increment
private long increment
identity
private java.lang.String identity
finalValue
private long finalValue
schemaName
private java.lang.String schemaName
tableName
private java.lang.String tableName
columnName
private java.lang.String columnName
counter
private long counter
columnPosition
private int columnPosition
initialized
private boolean initialized
| Constructor Detail |
AutoincrementCounter
public 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 Detail |
makeIdentity
public static java.lang.String makeIdentity(java.lang.String s, java.lang.String t, java.lang.String c)
- make a unique key for the counter.
makeIdentity
public static java.lang.String makeIdentity(org.apache.derby.iapi.sql.dictionary.TableDescriptor td, org.apache.derby.iapi.sql.dictionary.ColumnDescriptor cd)
- make a unique key for the counter.
reset
public void reset(boolean begin)
- reset to the counter to the beginning or the end.
update
public long update(long t)
- update the counter.
update
public long update()
throws org.apache.derby.iapi.error.StandardException
- update the counter to its next value.
getCurrentValue
public java.lang.Long getCurrentValue()
- get the current value of the counter. An uninitialized counter means the
current value is NULL.
getIdentity
public java.lang.String getIdentity()
- return the identity of the counter.
flushToDisk
public void flushToDisk(org.apache.derby.iapi.store.access.TransactionController tc, org.apache.derby.iapi.sql.dictionary.DataDictionary dd, org.apache.derby.catalog.UUID tableUUID) throws org.apache.derby.iapi.error.StandardException
- flush a counter to disk; i.e write the current value of the counter into
the row in SYSCOLUMNS.
getColumnPosition
public int getColumnPosition()
- get the column position in the table for which this counter has been
created.
getStartValue
public java.lang.Long getStartValue()
- get the start value
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ execute overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.impl.sql.execute.AutoincrementCounter