Class TabInfoImpl

java.lang.Object
org.apache.derby.impl.sql.catalog.TabInfoImpl

class TabInfoImpl extends Object
A poor mans structure used in DataDictionaryImpl.java. Used to save heapId, name pairs for non core tables.
  • Field Details

    • ROWNOTDUPLICATE

      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:
    • indexes

      private IndexInfoImpl[] indexes
    • heapConglomerate

      private long heapConglomerate
    • numIndexesSet

      private int numIndexesSet
    • heapSet

      private boolean heapSet
    • crf

      private final CatalogRowFactory crf
    • computedStreamStorableHeapColIds

      private boolean computedStreamStorableHeapColIds
    • streamStorableHeapColIds

      private int[] streamStorableHeapColIds
  • Constructor Details

    • TabInfoImpl

      TabInfoImpl(CatalogRowFactory crf)
      Constructor
      Parameters:
      crf - the associated CatalogRowFactory
  • Method Details

    • getHeapConglomerate

      long getHeapConglomerate()
      Get the conglomerate for the heap.
      Returns:
      long The conglomerate for the heap.
    • setHeapConglomerate

      void setHeapConglomerate(long heapConglomerate)
      Set the heap conglomerate for this.
      Parameters:
      heapConglomerate - The new heap conglomerate.
    • getIndexConglomerate

      long getIndexConglomerate(int indexID)
      Get the conglomerate for the specified index.
      Returns:
      long The conglomerate for the specified index.
    • setIndexConglomerate

      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
    • setIndexConglomerate

      void setIndexConglomerate(ConglomerateDescriptor cd)
      Set the index conglomerate for the table.
      Parameters:
      cd - The ConglomerateDescriptor for one of the index for this table.
    • getTableName

      String getTableName()
      Get the table name.
      Returns:
      String The table name.
    • getIndexName

      String getIndexName(int indexId)
      Get the index name.
      Parameters:
      indexId - Index number for index for table
      Returns:
      String The index name.
    • getCatalogRowFactory

      CatalogRowFactory getCatalogRowFactory()
      Get the CatalogRowFactory for this.
      Returns:
      CatalogRowFactory The CatalogRowFactory for this.
    • isComplete

      boolean isComplete()
      Is this fully initialized. (i.e., is all conglomerate info initialized)
      Returns:
      boolean Whether or not this is fully initialized.
    • getIndexColumnCount

      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

      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

      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.
    • getNumberOfIndexes

      int getNumberOfIndexes()
      Get the number of indexes on this catalog.
      Returns:
      int The number of indexes on this catalog.
    • getBaseColumnPosition

      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.
    • isIndexUnique

      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

      int insertRow(ExecRow row, TransactionController tc) throws StandardException
      Inserts a base row into a catalog and inserts all the corresponding index rows.
      Parameters:
      row - row to insert
      tc - transaction
      Returns:
      row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
      Throws:
      StandardException - Thrown on failure
    • insertRowList

      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 - 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
    • insertRowListImpl

      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 - the list of rows to insert
      tc - transaction controller
      rowLocationOut - on output rowLocationOut[0] is set to the last RowLocation inserted.
      Returns:
      row number (>= 0) if duplicate row inserted into an index ROWNOTDUPLICATE otherwise
      Throws:
      StandardException
    • deleteRow

      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
    • deleteRow

      int deleteRow(TransactionController tc, ExecIndexRow key, int indexNumber, boolean wait) throws StandardException
      Throws:
      StandardException
    • deleteRows

      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.
      qualifier - a qualifier for the scan.
      filter - filter on base rows
      stopKey - key to start the scan.
      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:
    • deleteRows

      private int deleteRows(TransactionController tc, ExecIndexRow startKey, int startOp, Qualifier[][] qualifier, TupleFilter filter, ExecIndexRow stopKey, int stopOp, int indexNumber, boolean wait) throws StandardException
      Throws:
      StandardException
    • getRow

      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
    • getRowLocation

      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 - 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:
    • getRow

      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 - transaction controller
      heapCC - heap to look in
      key - key to read by.
      indexNumber - Key is appropriate for this index.
      Throws:
      StandardException - Thrown on failure
    • getRowInternal

      private ExecRow getRowInternal(TransactionController tc, ConglomerateController heapCC, ExecIndexRow key, int indexNumber, RowLocation[] rl) throws StandardException
      Throws:
      StandardException - Thrown on failure
    • updateRow

      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 - 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 - array of ints indicating which columns (1 based) to update. If null, do all.
      tc - transaction controller
      Throws:
      StandardException - Thrown on failure
    • updateRow

      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 - key row
      newRows - new version of the array 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 - array of ints indicating which columns (1 based) to update. If null, do all.
      tc - transaction controller
      Throws:
      StandardException - Thrown on failure
    • getCreateHeapProperties

      Properties getCreateHeapProperties()
      Get the Properties associated with creating the heap.
      Returns:
      The Properties associated with creating the heap.
    • getCreateIndexProperties

      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.
    • getRowChanger

      private RowChanger getRowChanger(TransactionController tc, int[] changedCols, ExecRow baseRow) throws StandardException
      Gets a row changer for this catalog.
      Parameters:
      tc - transaction controller
      changedCols - the columns to change (1 based), may be null
      baseRow - 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:
      a row changer for this catalog.
      Throws:
      StandardException - Thrown on failure
    • getStreamStorableHeapColIds

      private int[] getStreamStorableHeapColIds(ExecRow baseRow) throws StandardException
      Throws:
      StandardException
    • getIndexRowFromHeapRow

      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 to use
      rl - RowLocation for heap
      heapRow - Row from the heap
      Returns:
      ExecIndexRow Index row.
      Throws:
      StandardException - Thrown on error
    • toString

      public String toString()
      Overrides:
      toString in class Object