Examples of TabInfo


Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

  private RowLocation computeRowLocation(TransactionController tc,
                      TableDescriptor td,
                      String columnName)
    throws StandardException                 
  {
    TabInfo ti = coreInfo[SYSCOLUMNS_CORE_NUM];
    ExecIndexRow keyRow = null;
    ExecRow row;
    UUID tableUUID = td.getUUID();

    keyRow = (ExecIndexRow)exFactory.getIndexableRow(2);
    keyRow.setColumn(1, dvf.getCharDataValue(tableUUID.toString()));
      keyRow.setColumn(2, dvf.getCharDataValue(columnName));
    return ti.getRowLocation(tc, keyRow,
                 SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX1_ID);
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

  /** @see DataDictionary#dropStatisticsDescriptors */
  public void dropStatisticsDescriptors(UUID tableUUID, UUID referenceUUID,
                   TransactionController tc)
    throws StandardException
  {
    TabInfo          ti = getNonCoreTI(SYSSTATISTICS_CATALOG_NUM);
    DataValueDescriptor first, second;
    first = dvf.getCharDataValue(tableUUID.toString());

    ExecIndexRow keyRow;
    if (referenceUUID != null)
    {
      keyRow = exFactory.getIndexableRow(2);
      second = dvf.getCharDataValue(referenceUUID.toString());
      keyRow.setColumn(2, second);
    }
    else
    {
      keyRow = exFactory.getIndexableRow(1);
    }

    keyRow.setColumn(1, first);

    ti.deleteRow(tc, keyRow,
           SYSSTATISTICSRowFactory.SYSSTATISTICS_INDEX1_ID);
   
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

      TransactionController tc)
    throws StandardException
  {
    ExecRow              row = null;
    int            type = descriptor.getConstraintType();
    TabInfo            ti = getNonCoreTI(SYSCONSTRAINTS_CATALOG_NUM);
    SYSCONSTRAINTSRowFactory  rf = (SYSCONSTRAINTSRowFactory) ti.getCatalogRowFactory();
    int            insertRetCode;

    if (SanityManager.DEBUG)
    {
      if (!(type == DataDictionary.PRIMARYKEY_CONSTRAINT ||
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

  {
    ExecIndexRow        keyRow1 = null;
    ExecRow              row;
    DataValueDescriptor      IDOrderable;
    DataValueDescriptor      columnNameOrderable;
    TabInfo            ti = getNonCoreTI(SYSCONSTRAINTS_CATALOG_NUM);
    SYSCONSTRAINTSRowFactory    rf = (SYSCONSTRAINTSRowFactory) ti.getCatalogRowFactory();

    /* Use objectID/columnName in both start
     * and stop position for index 1 scan.
     */
    IDOrderable = getValueAsDVD(formerUUID);

    /* Set up the start/stop position for the scan */
    keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
    keyRow1.setColumn(1, IDOrderable);

    // build the row to be stuffed into SYSCONSTRAINTS.
    row = rf.makeRow(cd, null);

    /*
    ** Figure out if the index in sysconstraints needs
    ** to be updated.
    */
    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(rf.getNumIndexes() == 3,
          "There are more indexes on sysconstraints than expected, the code herein needs to change");
    }

    boolean[] bArray = new boolean[3];

    /*
    ** Do we need to update indexes?
    */
    if (colsToSet == null)
    {
      bArray[0] = true;
      bArray[1] = true;
      bArray[2] = true;
    }
    else
    {
      /*
      ** Check the specific columns for indexed
      ** columns.
      */
      for (int i = 0; i < colsToSet.length; i++)
      {
        switch (colsToSet[i])
        {
          case SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_CONSTRAINTID:
            bArray[0] = true;
            break;

          case SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_CONSTRAINTNAME:
          case SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_SCHEMAID:
            bArray[1] = true;
            break;
         
          case SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_TABLEID:
            bArray[2] = true;
            break;
        }
      }
    }

    ti.updateRow(keyRow1, row,
           SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX1_ID,
           bArray,
           colsToSet,
           tc);
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

    throws StandardException
  {
    ExecIndexRow      keyRow = null;
    DataValueDescriptor    schemaIDOrderable;
    DataValueDescriptor    constraintNameOrderable;
    TabInfo          ti = getNonCoreTI(SYSCONSTRAINTS_CATALOG_NUM);

    switch (descriptor.getConstraintType())
    {
      case DataDictionary.PRIMARYKEY_CONSTRAINT:
      case DataDictionary.FOREIGNKEY_CONSTRAINT:
      case DataDictionary.UNIQUE_CONSTRAINT:
        dropSubKeyConstraint(
              descriptor,
              tc);
        break;

      case DataDictionary.CHECK_CONSTRAINT:
        dropSubCheckConstraint(
              descriptor.getUUID(),
              tc);
        break;
    }

    /* Use constraintNameOrderable and schemaIdOrderable in both start
     * and stop position for index 2 scan.
     */
    constraintNameOrderable = dvf.getVarcharDataValue(descriptor.getConstraintName());
    schemaIDOrderable = getValueAsDVD(descriptor.getSchemaDescriptor().getUUID());

    /* Set up the start/stop position for the scan */
    keyRow = (ExecIndexRow) exFactory.getIndexableRow(2);
    keyRow.setColumn(1, constraintNameOrderable);
    keyRow.setColumn(2, schemaIDOrderable);

    ti.deleteRow( tc, keyRow, SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX2_ID );
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

   */
  public SubKeyConstraintDescriptor getSubKeyConstraint(UUID constraintId, int type)
    throws StandardException
  {
    DataValueDescriptor    constraintIDOrderable = null;
    TabInfo          ti;
    int            indexNum;
    int            baseNum;

    if (type == DataDictionary.FOREIGNKEY_CONSTRAINT)
    {
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

  private void addSubKeyConstraint(KeyConstraintDescriptor descriptor,
                   TransactionController tc)
    throws StandardException
  {
    ExecRow  row;
    TabInfo  ti;

    /*
    ** Foreign keys get a row in SYSFOREIGNKEYS, and
    ** all others get a row in SYSKEYS.
    */
    if (descriptor.getConstraintType()
        == DataDictionary.FOREIGNKEY_CONSTRAINT)
    {
      ForeignKeyConstraintDescriptor fkDescriptor =
          (ForeignKeyConstraintDescriptor)descriptor;

      if (SanityManager.DEBUG)
      {
        if (!(descriptor instanceof ForeignKeyConstraintDescriptor))
        {
          SanityManager.THROWASSERT("descriptor not an fk descriptor, is "+
            descriptor.getClass().getName());
        }
      }
     
      ti = getNonCoreTI(SYSFOREIGNKEYS_CATALOG_NUM);
      SYSFOREIGNKEYSRowFactory fkkeysRF = (SYSFOREIGNKEYSRowFactory)ti.getCatalogRowFactory();

      row = fkkeysRF.makeRow(fkDescriptor, null);

      /*
      ** Now we need to bump the reference count of the
      ** contraint that this FK references
      */
      ReferencedKeyConstraintDescriptor refDescriptor =
              fkDescriptor.getReferencedConstraint();

      refDescriptor.incrementReferenceCount();

      int[] colsToSet = new int[1];
      colsToSet[0] = SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_REFERENCECOUNT;

      updateConstraintDescriptor(refDescriptor,
                      refDescriptor.getUUID(),
                      colsToSet,
                      tc);
    }
    else
    {
      ti = getNonCoreTI(SYSKEYS_CATALOG_NUM);
      SYSKEYSRowFactory keysRF = (SYSKEYSRowFactory) ti.getCatalogRowFactory();

      // build the row to be stuffed into SYSKEYS
      row = keysRF.makeRow(descriptor, null);
    }

    // insert row into catalog and all its indices
    ti.insertRow(row, tc, true);
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

  private void dropSubKeyConstraint(ConstraintDescriptor constraint, TransactionController tc)
    throws StandardException
  {
    ExecIndexRow      keyRow1 = null;
    DataValueDescriptor    constraintIdOrderable;
    TabInfo          ti;
    int            baseNum;
    int            indexNum;

    if (constraint.getConstraintType()
        == DataDictionary.FOREIGNKEY_CONSTRAINT)
    {
      baseNum = SYSFOREIGNKEYS_CATALOG_NUM;
      indexNum = SYSFOREIGNKEYSRowFactory.SYSFOREIGNKEYS_INDEX1_ID;

      /*
      ** If we have a foreign key, we need to decrement the
      ** reference count of the contraint that this FK references.
      ** We need to do this *before* we drop the foreign key
      ** because of the way FK.getReferencedConstraint() works. 
      */
      if (constraint.getConstraintType()
          == DataDictionary.FOREIGNKEY_CONSTRAINT)
      {
        ReferencedKeyConstraintDescriptor refDescriptor =
            (ReferencedKeyConstraintDescriptor)
                getConstraintDescriptor(
                  ((ForeignKeyConstraintDescriptor)constraint).
                      getReferencedConstraintId());

        if (refDescriptor != null)
        {
          refDescriptor.decrementReferenceCount();
 
          int[] colsToSet = new int[1];
          colsToSet[0] = SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_REFERENCECOUNT;
   
          updateConstraintDescriptor(refDescriptor,
                        refDescriptor.getUUID(),
                        colsToSet,
                        tc);
        }
      }
    }
    else
    {
      baseNum = SYSKEYS_CATALOG_NUM;
      indexNum = SYSKEYSRowFactory.SYSKEYS_INDEX1_ID;
    }

    ti = getNonCoreTI(baseNum);

    /* Use constraintIdOrderable in both start
     * and stop position for index 1 scan.
     */
    constraintIdOrderable = getValueAsDVD(constraint.getUUID());

    /* Set up the start/stop position for the scan */
    keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
    keyRow1.setColumn(1, constraintIdOrderable);

    ti.deleteRow( tc, keyRow1, indexNum);
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

   */
  private SubCheckConstraintDescriptor getSubCheckConstraint(UUID constraintId)
    throws StandardException
  {
    DataValueDescriptor      constraintIDOrderable = null;
    TabInfo            ti = getNonCoreTI(SYSCHECKS_CATALOG_NUM);
    SYSCHECKSRowFactory      rf = (SYSCHECKSRowFactory) ti.getCatalogRowFactory();

    /* Use constraintIDOrderable in both start and stop positions for scan */
    constraintIDOrderable = getValueAsDVD(constraintId);

    /* Set up the start/stop position for the scan */
 
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TabInfo

  private void dropSubCheckConstraint(UUID constraintId, TransactionController tc)
    throws StandardException
  {
    ExecIndexRow      checkRow1 = null;
    DataValueDescriptor    constraintIdOrderable;
    TabInfo          ti = getNonCoreTI(SYSCHECKS_CATALOG_NUM);

    /* Use constraintIdOrderable in both start
     * and stop position for index 1 scan.
     */
    constraintIdOrderable = getValueAsDVD(constraintId);

    /* Set up the start/stop position for the scan */
    checkRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
    checkRow1.setColumn(1, constraintIdOrderable);

    ti.deleteRow( tc, checkRow1, SYSCHECKSRowFactory.SYSCHECKS_INDEX1_ID );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.