org.apache.derby.iapi.sql.dictionary
Interface TabInfo

All Known Implementing Classes:
TabInfoImpl

public interface TabInfo

This interface is for communicating between the DataDictionary and the various CatalogRowFactories. It tries to hide as much about each catalog as it can behind this interface.


Field Summary
static int ROWNOTDUPLICATE
          ROWNOTDUPLICATE is out of range for a row number.
 
Method Summary
 int deleteRow(TransactionController tc, ExecIndexRow key, int indexNumber)
          Given a key row, delete all matching heap rows and their index rows.
 int deleteRowList(RowList rowList, LanguageConnectionContext lcc)
          Deletes a list of keyed rows from a catalog and all the corresponding index rows.
 int deleteRows(TransactionController tc, ExecIndexRow startKey, int startOp, Qualifier[][] qualifier, TupleFilter filter, ExecIndexRow stopKey, int stopOp, int indexNumber)
          Delete the set of rows defined by a scan on an index from the table.
 int getBaseColumnPosition(int indexNumber, int colNumber)
          Get the base column position for a column within a catalog given the (0-based) index number for this catalog and the (0-based) column number for the column within the index.
 CatalogRowFactory getCatalogRowFactory()
          Get the CatalogRowFactory for this TabInfo.
 java.util.Properties getCreateHeapProperties()
          Get the Properties associated with creating the heap.
 java.util.Properties getCreateIndexProperties(int indexNumber)
          Get the Properties associated with creating the specified index.
 long getHeapConglomerate()
          Get the conglomerate for the heap.
 int getIndexColumnCount(int indexNumber)
          Get the column count for the specified index number.
 long getIndexConglomerate(int indexID)
          Get the conglomerate for the specified index.
 java.lang.String getIndexName(int indexID)
          Get the index name.
 IndexRowGenerator getIndexRowGenerator(int indexNumber)
          Get the IndexRowGenerator for the specified index number.
 int getNumberOfIndexes()
          Get the number of indexes on this catalog.
 ExecRow getRow(TransactionController tc, ConglomerateController heap, ExecIndexRow key, int indexNumber)
          Given a key row, return the first matching heap row.
 ExecRow getRow(TransactionController tc, ExecIndexRow key, int indexNumber)
          Given a key row, return the first matching heap row.
 RowLocation getRowLocation(TransactionController tc, ExecIndexRow key, int indexNumber)
          Given an index row and index number return the RowLocation in the heap of the first matching row.
 java.lang.String getTableName()
          Get the table name.
 int insertRow(ExecRow row, LanguageConnectionContext lcc)
          Inserts a base row into a catalog and inserts all the corresponding index rows.
 int insertRow(ExecRow row, TransactionController tc, boolean wait)
          Inserts a base row into a catalog and inserts all the corresponding index rows.
 RowLocation insertRowAndFetchRowLocation(ExecRow r, TransactionController tc)
          Inserts a base row into a catalog and inserts all the corresponding index rows.
 int insertRowList(RowList rowList, LanguageConnectionContext lcc)
          Inserts a list of base rows into a catalog and inserts all the corresponding index rows.
 int insertRowList(RowList rowList, TransactionController tc)
          Inserts a list of base rows into a catalog and inserts all the corresponding index rows.
 boolean isComplete()
          Is the TabInfo fully initialized.
 boolean isIndexUnique(int indexNumber)
          Return whether or not this index is declared unique
 void setBaseColumnPosition(int indexNumber, int colNumber, int baseColumnPosition)
          Set the base column position for a column within a catalog given the (0-based) index number for this catalog and the (0-based) column number for the column within the index.
 void setHeapConglomerate(long heapConglomerate)
          Set the heap conglomerate for the TabInfo.
 void setIndexConglomerate(ConglomerateDescriptor cd)
          Set the index conglomerate for the table.
 void setIndexConglomerate(int index, long indexConglomerate)
          Set the index conglomerate for the table.
 void setIndexName(int indexID, java.lang.String indexName)
          Set the index name for the specified indexID
 void setIndexRowGenerator(int indexNumber, IndexRowGenerator irg)
          Set the IndexRowGenerator for the specified index number.
 int truncate(TransactionController tc)
          Delete all the rows from the table.
 void updateRow(ExecIndexRow key, ExecRow[] newRows, int indexNumber, boolean[] indicesToUpdate, int[] colsToUpdate, TransactionController tc)
          Updates a set of base rows in a catalog with same index key on an index and updates all the corresponding index rows.
 void updateRow(ExecIndexRow key, ExecRow newRow, int indexNumber, boolean[] indicesToUpdate, int[] colsToUpdate, TransactionController tc)
          Updates a base row in a catalog and updates all the corresponding index rows.
 void updateRow(ExecIndexRow key, ExecRow newRow, int indexNumber, boolean[] indicesToUpdate, int[] colsToUpdate, TransactionController tc, boolean wait)
          Updates a base row in a catalog and updates all the corresponding index rows.
 

Field Detail

ROWNOTDUPLICATE

public static final int ROWNOTDUPLICATE
ROWNOTDUPLICATE is out of range for a row number. If a return code does not equal this value, then it refers to the row that is a duplicate.

See Also:
Constant Field Values
Method Detail

getHeapConglomerate

public long getHeapConglomerate()
Get the conglomerate for the heap.

Returns:
long The conglomerate for the heap.

setHeapConglomerate

public void setHeapConglomerate(long heapConglomerate)
Set the heap conglomerate for the TabInfo.

Parameters:
heapConglomerate - The new heap conglomerate.
Returns:
Nothing.

getIndexConglomerate

public long getIndexConglomerate(int indexID)
Get the conglomerate for the specified index.

Returns:
long The conglomerate for the specified index.

setIndexConglomerate

public void setIndexConglomerate(int index,
                                 long indexConglomerate)
Set the index conglomerate for the table.

Parameters:
index - Index number for index for table
indexConglomerate - The conglomerate for that index
Returns:
Nothing

setIndexConglomerate

public void setIndexConglomerate(ConglomerateDescriptor cd)
Set the index conglomerate for the table.

Parameters:
cd - The ConglomerateDescriptor for one of the index for this table.
Returns:
Nothing

getTableName

public java.lang.String getTableName()
Get the table name.

Returns:
String The table name.

getIndexName

public java.lang.String getIndexName(int indexID)
Get the index name.

Parameters:
indexID - Index number for index for table
Returns:
String The index name.

setIndexName

public void setIndexName(int indexID,
                         java.lang.String indexName)
Set the index name for the specified indexID

Parameters:
indexID - Index number for index for table
indexName - The name for that index ID

getCatalogRowFactory

public CatalogRowFactory getCatalogRowFactory()
Get the CatalogRowFactory for this TabInfo.

Returns:
CatalogRowFactory The CatalogRowFactory for this TabInfo.

isComplete

public boolean isComplete()
Is the TabInfo fully initialized. (i.e., is all conglomerate info initialized)

Returns:
boolean Whether or not the TabInfo is fully initialized.

getIndexColumnCount

public int getIndexColumnCount(int indexNumber)
Get the column count for the specified index number.

Parameters:
indexNumber - The index number.
Returns:
int The column count for the specified index.

getIndexRowGenerator

public IndexRowGenerator getIndexRowGenerator(int indexNumber)
Get the IndexRowGenerator for the specified index number.

Parameters:
indexNumber - The index number.
Returns:
IndexRowGenerator The IRG for the specified index number.

setIndexRowGenerator

public void setIndexRowGenerator(int indexNumber,
                                 IndexRowGenerator irg)
Set the IndexRowGenerator for the specified index number.

Parameters:
indexNumber - The index number.
irg - The IndexRowGenerator for the specified index number.
Returns:
Nothing.

getNumberOfIndexes

public int getNumberOfIndexes()
Get the number of indexes on this catalog.

Returns:
int The number of indexes on this catalog.

getBaseColumnPosition

public int getBaseColumnPosition(int indexNumber,
                                 int colNumber)
Get the base column position for a column within a catalog given the (0-based) index number for this catalog and the (0-based) column number for the column within the index.

Parameters:
indexNumber - The index number
colNumber - The column number within the index
Returns:
int The base column position for the column.

setBaseColumnPosition

public void setBaseColumnPosition(int indexNumber,
                                  int colNumber,
                                  int baseColumnPosition)
Set the base column position for a column within a catalog given the (0-based) index number for this catalog and the (0-based) column number for the column within the index.

Parameters:
indexNumber - The index number
colNumber - The column number within the index
Returns:
Nothing.

isIndexUnique

public boolean isIndexUnique(int indexNumber)
Return whether or not this index is declared unique

Parameters:
indexNumber - The index number
Returns:
boolean Whether or not this index is declared unique

insertRow

public int insertRow(ExecRow row,
                     TransactionController tc,
                     boolean wait)
              throws StandardException
Inserts a base row into a catalog and inserts all the corresponding index rows.

Parameters:
row - row to insert
tc - transaction
wait - to wait for lock or not
Returns:
row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
Throws:
StandardException - Thrown on failure

insertRow

public int insertRow(ExecRow row,
                     LanguageConnectionContext lcc)
              throws StandardException
Inserts a base row into a catalog and inserts all the corresponding index rows.

Parameters:
row - row to insert
lcc - language state variable
Returns:
row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
Throws:
StandardException - Thrown on failure

insertRowAndFetchRowLocation

public RowLocation insertRowAndFetchRowLocation(ExecRow r,
                                                TransactionController tc)
                                         throws StandardException
Inserts a base row into a catalog and inserts all the corresponding index rows.

Parameters:
tc - transaction controller
Returns:
The row location for the inserted row.
Throws:
StandardException - Thrown on failure

deleteRowList

public int deleteRowList(RowList rowList,
                         LanguageConnectionContext lcc)
                  throws StandardException
Deletes a list of keyed rows from a catalog and all the corresponding index rows.

Parameters:
rowList - List of keyed rows to delete
lcc - language state variable
Returns:
the number of rows deleted.
Throws:
StandardException - Thrown on failure

insertRowList

public int insertRowList(RowList rowList,
                         TransactionController tc)
                  throws StandardException
Inserts a list of base rows into a catalog and inserts all the corresponding index rows.

Parameters:
rowList - List of rows to insert
tc - transaction controller
Returns:
row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
Throws:
StandardException - Thrown on failure

insertRowList

public int insertRowList(RowList rowList,
                         LanguageConnectionContext lcc)
                  throws StandardException
Inserts a list of base rows into a catalog and inserts all the corresponding index rows.

Parameters:
rowList - List of rows to insert
lcc - language state variable
Returns:
row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
Throws:
StandardException - Thrown on failure

truncate

public int truncate(TransactionController tc)
             throws StandardException
Delete all the rows from the table.

LOCKING: exclusive TABLE locking

Parameters:
tc - transaction controller
Returns:
the number of rows deleted.
Throws:
StandardException - Thrown on failure

deleteRows

public int deleteRows(TransactionController tc,
                      ExecIndexRow startKey,
                      int startOp,
                      Qualifier[][] qualifier,
                      TupleFilter filter,
                      ExecIndexRow stopKey,
                      int stopOp,
                      int indexNumber)
               throws StandardException
Delete the set of rows defined by a scan on an index from the table. Most of the parameters are simply passed to TransactionController.openScan. Please refer to the TransactionController documentation for details.

LOCKING: row locking if there is a start and a stop key; otherwise, table locking

Parameters:
tc - transaction controller
startKey - key to start the scan.
startOp - operation to start the scan.
stopKey - key to start the scan.
qualifier - a qualifier for the scan.
filter - filter on base rows
stopOp - operation to start the scan.
indexNumber - Key is appropriate for this index.
Returns:
the number of rows deleted.
Throws:
StandardException - Thrown on failure
See Also:
TransactionController.openScan(long, boolean, int, int, int, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.types.DataValueDescriptor[], int, org.apache.derby.iapi.store.access.Qualifier[][], org.apache.derby.iapi.types.DataValueDescriptor[], int)

deleteRow

public int deleteRow(TransactionController tc,
                     ExecIndexRow key,
                     int indexNumber)
              throws StandardException
Given a key row, delete all matching heap rows and their index rows.

LOCKING: row locking if there is a key; otherwise, table locking.

Parameters:
tc - transaction controller
key - key to delete by.
indexNumber - Key is appropriate for this index.
Returns:
the number of rows deleted. If key is not unique, this may be more than one.
Throws:
StandardException - Thrown on failure

getRow

public ExecRow getRow(TransactionController tc,
                      ExecIndexRow key,
                      int indexNumber)
               throws StandardException
Given a key row, return the first matching heap row.

LOCKING: shared row locking.

Parameters:
tc - transaction controller
key - key to read by.
indexNumber - Key is appropriate for this index.
Throws:
StandardException - Thrown on failure

getRow

public ExecRow getRow(TransactionController tc,
                      ConglomerateController heap,
                      ExecIndexRow key,
                      int indexNumber)
               throws StandardException
Given a key row, return the first matching heap row.

LOCKING: shared row locking.

Parameters:
tc - transaction controller
heap - heap to look in
key - key to read by.
indexNumber - Key is appropriate for this index.
Throws:
StandardException - Thrown on failure

getRowLocation

public RowLocation getRowLocation(TransactionController tc,
                                  ExecIndexRow key,
                                  int indexNumber)
                           throws StandardException
Given an index row and index number return the RowLocation in the heap of the first matching row. Used by the autoincrement code to get the RowLocation in syscolumns given a pair.

Parameters:
tc - Transaction Controller to use.
key - Index Row to search in the index.
indexNumber - Identifies the index to use.
Throws:
StandardException - thrown on failure.
See Also:
DataDictionaryImpl.computeRowLocation(TransactionController, TableDescriptor, String)

updateRow

public void updateRow(ExecIndexRow key,
                      ExecRow[] newRows,
                      int indexNumber,
                      boolean[] indicesToUpdate,
                      int[] colsToUpdate,
                      TransactionController tc)
               throws StandardException
Updates a set of base rows in a catalog with same index key on an index and updates all the corresponding index rows.

LOCKING: exclusive row locking

Parameters:
key - key row
newRows - new version of the set of rows
indexNumber - index that key operates
indicesToUpdate - array of booleans, one for each index on the catalog. if a boolean is true, that means we must update the corresponding index because changes in the newRow affect it.
colsToUpdate - int array of columns to be updated (1 based). If null, all cols are updated
tc - transaction controller
Throws:
StandardException - Thrown on failure

updateRow

public void updateRow(ExecIndexRow key,
                      ExecRow newRow,
                      int indexNumber,
                      boolean[] indicesToUpdate,
                      int[] colsToUpdate,
                      TransactionController tc)
               throws StandardException
Updates a base row in a catalog and updates all the corresponding index rows.

LOCKING: exclusive row locking

Parameters:
key - key row
newRow - new version of the row
indexNumber - index that key operates
indicesToUpdate - array of booleans, one for each index on the catalog. if a boolean is true, that means we must update the corresponding index because changes in the newRow affect it.
colsToUpdate - int array of columns to be updated (1 based). If null, all cols are updated
tc - transaction controller
Throws:
StandardException - Thrown on failure

updateRow

public void updateRow(ExecIndexRow key,
                      ExecRow newRow,
                      int indexNumber,
                      boolean[] indicesToUpdate,
                      int[] colsToUpdate,
                      TransactionController tc,
                      boolean wait)
               throws StandardException
Updates a base row in a catalog and updates all the corresponding index rows.

LOCKING: exclusive row locking

Parameters:
key - key row
newRow - new version of the row
indexNumber - index that key operates
indicesToUpdate - array of booleans, one for each index on the catalog. if a boolean is true, that means we must update the corresponding index because changes in the newRow affect it.
colsToUpdate - int array of columns to be updated (1 based). If null, all cols are updated
tc - transaction controller
wait - If true, then the caller wants to wait for locks. False will be when we using a nested user xaction - we want to timeout right away if the parent holds the lock. (bug 4821)
Throws:
StandardException - Thrown on failure

getCreateHeapProperties

public java.util.Properties getCreateHeapProperties()
Get the Properties associated with creating the heap.

Returns:
The Properties associated with creating the heap.

getCreateIndexProperties

public java.util.Properties getCreateIndexProperties(int indexNumber)
Get the Properties associated with creating the specified index.

Parameters:
indexNumber - The specified index number.
Returns:
The Properties associated with creating the specified index.


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.