Top Description Fields Constructors Methods
org.apache.derby.impl.sql.catalog

pack-priv Class TabInfoImpl

extends Object
Class Inheritance
Imports
org.apache.derby.iapi.services.io.FormatableBitSet, .StreamStorable, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.dictionary.CatalogRowFactory, .ConglomerateDescriptor, .IndexRowGenerator, org.apache.derby.iapi.sql.execute.ExecIndexRow, .ExecRow, .RowChanger, .TupleFilter, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.store.access.ConglomerateController, .DynamicCompiledOpenConglomInfo, .Qualifier, .ScanController, .StaticCompiledOpenConglomInfo, .TransactionController, org.apache.derby.iapi.types.DataValueDescriptor, .RowLocation, java.util.Properties

A poor mans structure used in DataDictionaryImpl.java. Used to save heapId, name pairs for non core tables.

Field Summary

Modifier and TypeField and Description
private boolean
private final CatalogRowFactory
private long
private boolean
private IndexInfoImpl[]
private int
pack-priv static final int
ROWNOTDUPLICATE

ROWNOTDUPLICATE is out of range for a row number.

private int[]

Constructor Summary

AccessConstructor and Description
pack-priv
TabInfoImpl(CatalogRowFactory
the associated CatalogRowFactory
crf
)

Constructor

Method Summary

Modifier and TypeMethod and Description
pack-priv int

Returns:

the number of rows deleted. If key is not unique, this may be more than one.
deleteRow
(TransactionController
transaction controller
tc
,
ExecIndexRow
key to delete by.
key
,
int
Key is appropriate for this index.
indexNumber
)

Given a key row, delete all matching heap rows and their index rows.

pack-priv int
deleteRow(TransactionController tc, ExecIndexRow key, int indexNumber, boolean wait)

pack-priv int

Returns:

the number of rows deleted.
deleteRows
(TransactionController
transaction controller
tc
,
ExecIndexRow
key to start the scan.
startKey
,
int
operation to start the scan.
startOp
,
Qualifier[][]
a qualifier for the scan.
qualifier
,
TupleFilter
filter on base rows
filter
,
ExecIndexRow
key to start the scan.
stopKey
,
int
operation to start the scan.
stopOp
,
int
Key is appropriate for this index.
indexNumber
)

Delete the set of rows defined by a scan on an index from the table.

private int
deleteRows(TransactionController tc, ExecIndexRow startKey, int startOp, Qualifier[][] qualifier, TupleFilter filter, ExecIndexRow stopKey, int stopOp, int indexNumber, boolean wait)

pack-priv int

Returns:

int The base column position for the column.
getBaseColumnPosition
(int
The index number
indexNumber
,
int
The column number within the index
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.

pack-priv CatalogRowFactory

Returns:

CatalogRowFactory The CatalogRowFactory for this.
getCatalogRowFactory
()

Get the CatalogRowFactory for this.

pack-priv Properties

Returns:

The Properties associated with creating the heap.
getCreateHeapProperties
()

Get the Properties associated with creating the heap.

pack-priv Properties

Returns:

The Properties associated with creating the specified index.
getCreateIndexProperties
(int
The specified index number.
indexNumber
)

Get the Properties associated with creating the specified index.

pack-priv long

Returns:

long The conglomerate for the heap.
getHeapConglomerate
()

Get the conglomerate for the heap.

pack-priv int

Returns:

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

Get the column count for the specified index number.

pack-priv long

Returns:

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

Get the conglomerate for the specified index.

pack-priv String

Returns:

String The index name.
getIndexName
(int
Index number for index for table
indexId
)

Get the index name.

private ExecIndexRow

Returns:

ExecIndexRow Index row.
getIndexRowFromHeapRow
(IndexRowGenerator
IndexRowGenerator to use
irg
,
RowLocation
RowLocation for heap
rl
,
ExecRow
Row from the heap
heapRow
)

Get an index row based on a row from the heap.

pack-priv IndexRowGenerator

Returns:

IndexRowGenerator The IRG for the specified index number.
getIndexRowGenerator
(int
The index number.
indexNumber
)

Get the IndexRowGenerator for the specified index number.

pack-priv int

Returns:

int The number of indexes on this catalog.
getNumberOfIndexes
()

Get the number of indexes on this catalog.

pack-priv ExecRow
getRow(TransactionController
transaction controller
tc
,
ExecIndexRow
key to read by.
key
,
int
Key is appropriate for this index.
indexNumber
)

Given a key row, return the first matching heap row.

pack-priv ExecRow
getRow(TransactionController
transaction controller
tc
,
ConglomerateController
heap to look in
heapCC
,
ExecIndexRow
key to read by.
key
,
int
Key is appropriate for this index.
indexNumber
)

Given a key row, return the first matching heap row.

private RowChanger

Returns:

a row changer for this catalog.
getRowChanger
(TransactionController
transaction controller
tc
,
int[]
the columns to change (1 based), may be null
changedCols
,
ExecRow
used to detemine column types at creation time only. The row changer does ***Not*** keep a referance to this row or change it in any way.
baseRow
)

Gets a row changer for this catalog.

private ExecRow
pack-priv RowLocation
getRowLocation(TransactionController
Transaction Controller to use.
tc
,
ExecIndexRow
Index Row to search in the index.
key
,
int
Identifies the index to use.
indexNumber
)

Given an index row and index number return the RowLocation in the heap of the first matching row.

private int[]
pack-priv String

Returns:

String The table name.
getTableName
()

Get the table name.

pack-priv int

Returns:

row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
insertRow
(ExecRow
row to insert
row
,
TransactionController
transaction
tc
)

Inserts a base row into a catalog and inserts all the corresponding index rows.

pack-priv int

Returns:

row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
insertRowList
(ExecRow[]
List of rows to insert
rowList
,
TransactionController
transaction controller
tc
)

Inserts a list of base rows into a catalog and inserts all the corresponding index rows.

private int

Returns:

row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
insertRowListImpl
(ExecRow[]
the list of rows to insert
rowList
,
TransactionController
transaction controller
tc
,
RowLocation[]
on output rowLocationOut[0] is set to the last RowLocation inserted.
rowLocationOut
)

Insert logic to insert a list of rows into a table.

pack-priv boolean

Returns:

boolean Whether or not this is fully initialized.
isComplete
()

Is this fully initialized.

pack-priv boolean

Returns:

boolean Whether or not this index is declared unique
isIndexUnique
(int
The index number
indexNumber
)

Return whether or not this index is declared unique

pack-priv void
setHeapConglomerate(long
The new heap conglomerate.
heapConglomerate
)

Set the heap conglomerate for this.

pack-priv void
setIndexConglomerate(int
Index number for index for table
index
,
long
The conglomerate for that index
indexConglomerate
)

Set the index conglomerate for the table.

pack-priv void
setIndexConglomerate(ConglomerateDescriptor
The ConglomerateDescriptor for one of the index for this table.
cd
)

Set the index conglomerate for the table.

pack-priv void
setIndexRowGenerator(int
The index number.
indexNumber
,
IndexRowGenerator
The IndexRowGenerator for the specified index number.
irg
)

Set the IndexRowGenerator for the specified index number.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv void
updateRow(ExecIndexRow
key row
key
,
ExecRow
new version of the row
newRow
,
int
index that key operates
indexNumber
,
boolean[]
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.
indicesToUpdate
,
int[]
array of ints indicating which columns (1 based) to update. If null, do all.
colsToUpdate
,
TransactionController
transaction controller
tc
)

Updates a base row in a catalog and updates all the corresponding index rows.

pack-priv void
updateRow(ExecIndexRow
key row
key
,
ExecRow[]
new version of the array of rows
newRows
,
int
index that key operates
indexNumber
,
boolean[]
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.
indicesToUpdate
,
int[]
array of ints indicating which columns (1 based) to update. If null, do all.
colsToUpdate
,
TransactionController
transaction controller
tc
)

Updates a set of base rows in a catalog with the same key on an index and updates all the corresponding index rows.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

computedStreamStorableHeapColIdsback to summary
private boolean computedStreamStorableHeapColIds
crfback to summary
private final CatalogRowFactory crf
heapConglomerateback to summary
private long heapConglomerate
heapSetback to summary
private boolean heapSet
indexesback to summary
private IndexInfoImpl[] indexes
numIndexesSetback to summary
private int numIndexesSet
ROWNOTDUPLICATEback to summary
pack-priv 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.

streamStorableHeapColIdsback to summary
private int[] streamStorableHeapColIds

Constructor Detail

TabInfoImplback to summary
pack-priv TabInfoImpl(CatalogRowFactory crf)

Constructor

Parameters
crf:CatalogRowFactory

the associated CatalogRowFactory

Method Detail

deleteRowback to summary
pack-priv 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:TransactionController

transaction controller

key:ExecIndexRow

key to delete by.

indexNumber:int

Key is appropriate for this index.

Returns:int

the number of rows deleted. If key is not unique, this may be more than one.

Exceptions
StandardException:
Thrown on failure
deleteRowback to summary
pack-priv int deleteRow(TransactionController tc, ExecIndexRow key, int indexNumber, boolean wait) throws StandardException
deleteRowsback to summary
pack-priv 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:TransactionController

transaction controller

startKey:ExecIndexRow

key to start the scan.

startOp:int

operation to start the scan.

qualifier:Qualifier[][]

a qualifier for the scan.

filter:TupleFilter

filter on base rows

stopKey:ExecIndexRow

key to start the scan.

stopOp:int

operation to start the scan.

indexNumber:int

Key is appropriate for this index.

Returns:int

the number of rows deleted.

Exceptions
StandardException:
Thrown on failure
See Also
TransactionController#openScan
deleteRowsback to summary
private int deleteRows(TransactionController tc, ExecIndexRow startKey, int startOp, Qualifier[][] qualifier, TupleFilter filter, ExecIndexRow stopKey, int stopOp, int indexNumber, boolean wait) throws StandardException
getBaseColumnPositionback to summary
pack-priv 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:int

The index number

colNumber:int

The column number within the index

Returns:int

int The base column position for the column.

getCatalogRowFactoryback to summary
pack-priv CatalogRowFactory getCatalogRowFactory()

Get the CatalogRowFactory for this.

Returns:CatalogRowFactory

CatalogRowFactory The CatalogRowFactory for this.

getCreateHeapPropertiesback to summary
pack-priv Properties getCreateHeapProperties()

Get the Properties associated with creating the heap.

Returns:Properties

The Properties associated with creating the heap.

getCreateIndexPropertiesback to summary
pack-priv Properties getCreateIndexProperties(int indexNumber)

Get the Properties associated with creating the specified index.

Parameters
indexNumber:int

The specified index number.

Returns:Properties

The Properties associated with creating the specified index.

getHeapConglomerateback to summary
pack-priv long getHeapConglomerate()

Get the conglomerate for the heap.

Returns:long

long The conglomerate for the heap.

getIndexColumnCountback to summary
pack-priv int getIndexColumnCount(int indexNumber)

Get the column count for the specified index number.

Parameters
indexNumber:int

The index number.

Returns:int

int The column count for the specified index.

getIndexConglomerateback to summary
pack-priv long getIndexConglomerate(int indexID)

Get the conglomerate for the specified index.

Returns:long

long The conglomerate for the specified index.

getIndexNameback to summary
pack-priv String getIndexName(int indexId)

Get the index name.

Parameters
indexId:int

Index number for index for table

Returns:String

String The index name.

getIndexRowFromHeapRowback to summary
private ExecIndexRow getIndexRowFromHeapRow(IndexRowGenerator irg, RowLocation rl, ExecRow heapRow) throws StandardException

Get an index row based on a row from the heap.

Parameters
irg:IndexRowGenerator

IndexRowGenerator to use

rl:RowLocation

RowLocation for heap

heapRow:ExecRow

Row from the heap

Returns:ExecIndexRow

ExecIndexRow Index row.

Exceptions
StandardException:
Thrown on error
getIndexRowGeneratorback to summary
pack-priv IndexRowGenerator getIndexRowGenerator(int indexNumber)

Get the IndexRowGenerator for the specified index number.

Parameters
indexNumber:int

The index number.

Returns:IndexRowGenerator

IndexRowGenerator The IRG for the specified index number.

getNumberOfIndexesback to summary
pack-priv int getNumberOfIndexes()

Get the number of indexes on this catalog.

Returns:int

int The number of indexes on this catalog.

getRowback to summary
pack-priv 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:TransactionController

transaction controller

key:ExecIndexRow

key to read by.

indexNumber:int

Key is appropriate for this index.

Exceptions
StandardException:
Thrown on failure
getRowback to summary
pack-priv ExecRow getRow(TransactionController tc, ConglomerateController heapCC, ExecIndexRow key, int indexNumber) throws StandardException

Given a key row, return the first matching heap row.

LOCKING: shared row locking.

Parameters
tc:TransactionController

transaction controller

heapCC:ConglomerateController

heap to look in

key:ExecIndexRow

key to read by.

indexNumber:int

Key is appropriate for this index.

Exceptions
StandardException:
Thrown on failure
getRowChangerback to summary
private RowChanger getRowChanger(TransactionController tc, int[] changedCols, ExecRow baseRow) throws StandardException

Gets a row changer for this catalog.

Parameters
tc:TransactionController

transaction controller

changedCols:int[]

the columns to change (1 based), may be null

baseRow:ExecRow

used to detemine column types at creation time only. The row changer does ***Not*** keep a referance to this row or change it in any way.

Returns:RowChanger

a row changer for this catalog.

Exceptions
StandardException:
Thrown on failure
getRowInternalback to summary
private ExecRow getRowInternal(TransactionController tc, ConglomerateController heapCC, ExecIndexRow key, int indexNumber, RowLocation[] rl) throws StandardException
Exceptions
StandardException:
Thrown on failure
getRowLocationback to summary
pack-priv 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 <tablename, columname> pair.

Parameters
tc:TransactionController

Transaction Controller to use.

key:ExecIndexRow

Index Row to search in the index.

indexNumber:int

Identifies the index to use.

Exceptions
StandardException:
thrown on failure.
See Also
DataDictionaryImpl#computeRowLocation(TransactionController, TableDescriptor, String)
getStreamStorableHeapColIdsback to summary
private int[] getStreamStorableHeapColIds(ExecRow baseRow) throws StandardException
getTableNameback to summary
pack-priv String getTableName()

Get the table name.

Returns:String

String The table name.

insertRowback to summary
pack-priv int insertRow(ExecRow row, TransactionController tc) throws StandardException

Inserts a base row into a catalog and inserts all the corresponding index rows.

Parameters
row:ExecRow

row to insert

tc:TransactionController

transaction

Returns:int

row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise

Exceptions
StandardException:
Thrown on failure
insertRowListback to summary
pack-priv int insertRowList(ExecRow[] rowList, TransactionController tc) throws StandardException

Inserts a list of base rows into a catalog and inserts all the corresponding index rows.

Parameters
rowList:ExecRow[]

List of rows to insert

tc:TransactionController

transaction controller

Returns:int

row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise

Exceptions
StandardException:
Thrown on failure
insertRowListImplback to summary
private int insertRowListImpl(ExecRow[] rowList, TransactionController tc, RowLocation[] rowLocationOut) throws StandardException

Insert logic to insert a list of rows into a table. This logic has two odd features.

  1. Returns an indication if any returned row was a duplicate.
  2. Returns the RowLocation of the last row inserted.
Parameters
rowList:ExecRow[]

the list of rows to insert

tc:TransactionController

transaction controller

rowLocationOut:RowLocation[]

on output rowLocationOut[0] is set to the last RowLocation inserted.

Returns:int

row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise

isCompleteback to summary
pack-priv boolean isComplete()

Is this fully initialized. (i.e., is all conglomerate info initialized)

Returns:boolean

boolean Whether or not this is fully initialized.

isIndexUniqueback to summary
pack-priv boolean isIndexUnique(int indexNumber)

Return whether or not this index is declared unique

Parameters
indexNumber:int

The index number

Returns:boolean

boolean Whether or not this index is declared unique

setHeapConglomerateback to summary
pack-priv void setHeapConglomerate(long heapConglomerate)

Set the heap conglomerate for this.

Parameters
heapConglomerate:long

The new heap conglomerate.

setIndexConglomerateback to summary
pack-priv void setIndexConglomerate(int index, long indexConglomerate)

Set the index conglomerate for the table.

Parameters
index:int

Index number for index for table

indexConglomerate:long

The conglomerate for that index

setIndexConglomerateback to summary
pack-priv void setIndexConglomerate(ConglomerateDescriptor cd)

Set the index conglomerate for the table.

Parameters
cd:ConglomerateDescriptor

The ConglomerateDescriptor for one of the index for this table.

setIndexRowGeneratorback to summary
pack-priv void setIndexRowGenerator(int indexNumber, IndexRowGenerator irg)

Set the IndexRowGenerator for the specified index number.

Parameters
indexNumber:int

The index number.

irg:IndexRowGenerator

The IndexRowGenerator for the specified index number.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

updateRowback to summary
pack-priv 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.

Parameters
key:ExecIndexRow

key row

newRow:ExecRow

new version of the row

indexNumber:int

index that key operates

indicesToUpdate:boolean[]

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 ints indicating which columns (1 based) to update. If null, do all.

tc:TransactionController

transaction controller

Exceptions
StandardException:
Thrown on failure
updateRowback to summary
pack-priv 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 the same key on an index and updates all the corresponding index rows.

Parameters
key:ExecIndexRow

key row

newRows:ExecRow[]

new version of the array of rows

indexNumber:int

index that key operates

indicesToUpdate:boolean[]

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 ints indicating which columns (1 based) to update. If null, do all.

tc:TransactionController

transaction controller

Exceptions
StandardException:
Thrown on failure