Examples of ExecRow


Examples of org.apache.derby.iapi.sql.execute.ExecRow

            TransactionController tc, ContextManager cm,
            FKInfo fkInfo, long fkConglom, long pkConglom,
            String fkConstraintName)
    throws StandardException
  {
    ExecRow                 template;
    GroupFetchScanController   refScan = null;
    GroupFetchScanController   fkScan  = null;

    try
    {

        template = makeIndexTemplate(fkInfo, fullTemplate, cm);

        /*
        ** The indexes have been dropped and recreated, so
        ** we need to get the new index conglomerate number.
        */
        fkScan =
                    tc.openGroupFetchScan(
                        fkConglom,
                        false,                       // hold
                        0,                // read only
                        tc.MODE_TABLE,         // doesn't matter,
                                                     //   already locked
                        tc.ISOLATION_READ_COMMITTED, // doesn't matter,
                                                     //   already locked
                        (FormatableBitSet)null,          // retrieve all fields
                        (DataValueDescriptor[])null, // startKeyValue
                        ScanController.GE,           // startSearchOp
                        null,                        // qualifier
                        (DataValueDescriptor[])null, // stopKeyValue
                        ScanController.GT            // stopSearchOp
                        );

        if (SanityManager.DEBUG)
        { 
          /*
          ** Bulk insert replace calls this method regardless
          ** of whether or not any rows were inserted because
          ** it has to check any referencing foreign keys
          ** after the replace.  Otherwise, we
          ** make sure that we actually have a row in the fk.
          ** If not, we have an error because we thought that
          ** since indexRows != null, we must have gotten some
          ** rows.
          */
          if (! bulkInsertReplace)
          {
            SanityManager.ASSERT(fkScan.next(),
              "No rows in fk index, even though indexRows != null");
     
            /*
            ** Crank up the scan again.
            */ 
            fkScan.reopenScan(
              (DataValueDescriptor[])null,    // startKeyValue
              ScanController.GE,              // startSearchOp
              null,                           // qualifier
              (DataValueDescriptor[])null,    // stopKeyValue
              ScanController.GT               // stopSearchOp
                          );
          }
        }

        /*
        ** Open the referenced key scan.  Use row locking on
        ** the referenced table unless it is self-referencing
         ** (in which case we don't need locks)
        */ 
        refScan =
                    tc.openGroupFetchScan(
            pkConglom,
            false,                         // hold
            0,                 // read only
                        (fkConglom == pkConglom) ?
                tc.MODE_TABLE :
                tc.MODE_RECORD,
            tc.ISOLATION_READ_COMMITTED,  // read committed is
                                                        //    good enough
            (FormatableBitSet)null,           // retrieve all fields
            (DataValueDescriptor[])null,    // startKeyValue
            ScanController.GE,              // startSearchOp
            null,                           // qualifier
            (DataValueDescriptor[])null,    // stopKeyValue
            ScanController.GT               // stopSearchOp
            );

        /*
        ** Give the scans to the bulk checker to do its
        ** magic.  It will do a merge on the two indexes.
        */ 
        ExecRow firstFailedRow = template.getClone();
        RIBulkChecker riChecker = new RIBulkChecker(refScan,
                      fkScan,
                      template,  
                      true,         // fail on 1st failure
                      (ConglomerateController)null,
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

   * Make a template row with the correct columns.
   */
  private ExecRow makeIndexTemplate(FKInfo fkInfo, ExecRow fullTemplate, ContextManager cm)
    throws StandardException
  {
    ExecRow newRow = RowUtil.getEmptyIndexRow(fkInfo.colArray.length+1, lcc);

    DataValueDescriptor[] templateColArray = fullTemplate.getRowArray();
    DataValueDescriptor[] newRowColArray   = newRow.getRowArray();

    int i;
    for (i = 0; i < fkInfo.colArray.length; i++)
    {
      newRowColArray[i] =
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

                ExecRow fullTemplate)
    throws StandardException
  {
    int          numIndexes = constants.irgs.length;
    ExecIndexRow[]    indexRows = new ExecIndexRow[numIndexes];
    ExecRow        baseRows = null;
    ColumnOrdering[][]  ordering = new ColumnOrdering[numIndexes][];
    int          numColumns = td.getNumberOfColumns();

    // Create the BitSet for mapping the partial row to the full row
    FormatableBitSet bitSet = new FormatableBitSet(numColumns + 1);
    // Need to check each index for referenced columns
    int numReferencedColumns = 0;
    for (int index = 0; index < numIndexes; index++)
    {
      int[] baseColumnPositions = constants.irgs[index].baseColumnPositions();
      for (int bcp = 0; bcp < baseColumnPositions.length; bcp++)
      {
        if (! bitSet.get(baseColumnPositions[bcp]))
        {
          bitSet.set(baseColumnPositions[bcp] );
          numReferencedColumns++;
        }
      }
    }

    // We can finally create the partial base row
    baseRows =
            activation.getExecutionFactory().getValueRow(numReferencedColumns);

    // Fill in each base row with nulls of the correct data type
    int colNumber = 0;
    for (int index = 0; index < numColumns; index++)
    {
      if (bitSet.get(index + 1))
      {
        colNumber++;
        // NOTE: 1-based column numbers
        baseRows.setColumn(
            colNumber,
            fullTemplate.getColumn(index + 1).getClone());
      }
    }
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

    /* Next, using each of the ColPermDescriptor's uuid, get the unique row
    in SYSCOLPERMS and adjust the "COLUMNS" column in SYSCOLPERMS to
    accomodate the added or dropped column in the tableid*/
    ColPermsDescriptor colPermsDescriptor;
    ExecRow curRow;
    ExecIndexRow uuidKey;
    // Not updating any indexes on SYSCOLPERMS
    boolean[] bArray = new boolean[SYSCOLPERMSRowFactory.TOTAL_NUM_OF_INDEXES];
    int[] colsToUpdate = {SYSCOLPERMSRowFactory.COLUMNS_COL_NUM};
    for (Iterator iterator = permissionDescriptorsList.iterator(); iterator.hasNext(); )
    {
      colPermsDescriptor = (ColPermsDescriptor) iterator.next();
      removePermEntryInCache(colPermsDescriptor);
      uuidKey = rf.buildIndexKeyRow(rf.COLPERMSID_INDEX_NUM, colPermsDescriptor);
      curRow=ti.getRow(tc, uuidKey, rf.COLPERMSID_INDEX_NUM);
          FormatableBitSet columns = (FormatableBitSet) curRow.getColumn(
            SYSCOLPERMSRowFactory.COLUMNS_COL_NUM).getObject();
      // See whether this is ADD COLUMN or DROP COLUMN. If ADD, then
      // add a new bit to the bit set. If DROP, then remove the bit
      // for the dropped column.
      if (columnDescriptor == null)
      {
        int currentLength = columns.getLength();
        columns.grow(currentLength+1);
      }
      else
      {
        FormatableBitSet modifiedColumns=new FormatableBitSet(columns);
        modifiedColumns.shrink(columns.getLength()-1);
        // All the bits from 0 ... colPosition-2 are OK. The bits from
        // colPosition to the end need to be shifted 1 to the left.
        // The bit for colPosition-1 simply disappears from COLUMNS.
        // ColumnPosition values count from 1, while bits in the
        // FormatableBitSet count from 0.
        for (int i = columnDescriptor.getPosition()-1;
            i < modifiedColumns.getLength();
            i++)
        {
          if (columns.isSet(i+1))
            modifiedColumns.set(i);
          else
            modifiedColumns.clear(i);
        }
        columns = modifiedColumns;
      }
          curRow.setColumn(SYSCOLPERMSRowFactory.COLUMNS_COL_NUM,
            dvf.getDataValue((Object) columns));
      ti.updateRow(uuidKey, curRow,
          SYSCOLPERMSRowFactory.COLPERMSID_INDEX_NUM,
           bArray,
           colsToUpdate,
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

    throws StandardException
  {
    TabInfoImpl  ti = getNonCoreTI(SYSROUTINEPERMS_CATALOG_NUM);
    SYSROUTINEPERMSRowFactory rf = (SYSROUTINEPERMSRowFactory) ti.getCatalogRowFactory();
    DataValueDescriptor  routineIdOrderable;
    ExecRow curRow;
    PermissionsDescriptor perm;

    // In Derby authorization mode, permission catalogs may not be present
    if (!usesSqlAuthorization)
      return;
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

   * Also look at Track#2432/change 12433
   */
  protected ExecRow getNextRowCore(NoPutResultSet source)
    throws StandardException
  {
    ExecRow row = source.getNextRowCore();
    if (needToObjectifyStream)
    {
      /*
         See comments in the constructor. We also need to load the column
         if it is part of an index on an insert but that is done in
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

              ExecRow deferredBaseRow,
              FormatableBitSet baseRowReadList,
              LanguageConnectionContext lcc)
        throws StandardException
  {
    ExecRow deferredSparseRow;

    if (baseRowReadList == null)
    {
      /* No sparse row */
      deferredSparseRow = deferredBaseRow;
    }
    else
    {
      /*
      ** We need to do a fetch doing a partial row
      ** read.  We need to shift our 1-based bit
      ** set to a zero based bit set like the store
      ** expects.
      */
      deferredSparseRow =
        RowUtil.getEmptyValueRow(
                baseRowReadList.getLength() - 1,
                lcc);
      /*
      ** getColumn(), setColumn(), and baseRowReadList are
      ** one-based.
      */
      int fromPosition = 1;
      for (int i = 1; i <= deferredSparseRow.nColumns(); i++)
      {
        if (baseRowReadList.isSet(i))
        {
          deferredSparseRow.setColumn(
            i,
            deferredBaseRow.getColumn(fromPosition++)
            );
        }
      }
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

  private void dropTablePermDescriptor(
          TransactionController tc,
          ExecIndexRow keyRow)
      throws StandardException
  {
    ExecRow curRow;
    PermissionsDescriptor perm;
    TabInfoImpl  ti = getNonCoreTI(SYSTABLEPERMS_CATALOG_NUM);
    SYSTABLEPERMSRowFactory rf = (SYSTABLEPERMSRowFactory) ti.getCatalogRowFactory();

    while ((curRow=ti.getRow(tc, keyRow, rf.TABLEID_INDEX_NUM)) != null)
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

  private void dropColumnPermDescriptor(
          TransactionController tc,
          ExecIndexRow keyRow)
      throws StandardException
  {
    ExecRow curRow;
    PermissionsDescriptor perm;
    TabInfoImpl  ti = getNonCoreTI(SYSCOLPERMS_CATALOG_NUM);
    SYSCOLPERMSRowFactory rf = (SYSCOLPERMSRowFactory) ti.getCatalogRowFactory();

    while ((curRow=ti.getRow(tc, keyRow, rf.TABLEID_INDEX_NUM)) != null)
View Full Code Here

Examples of org.apache.derby.iapi.sql.execute.ExecRow

                    TransactionController tc,
                    boolean wait)
    throws StandardException
  {
    ExecIndexRow        keyRow1 = null;
    ExecRow              row;
    DataValueDescriptor      refIDOrderable;
    DataValueDescriptor      columnNameOrderable;
    TabInfoImpl            ti = coreInfo[SYSCOLUMNS_CORE_NUM];
    SYSCOLUMNSRowFactory  rf = (SYSCOLUMNSRowFactory) ti.getCatalogRowFactory();
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.