Examples of ScanController


Examples of org.apache.derby.iapi.store.access.ScanController

                (long[]) null);

    closeBulkFetchScan();

    // Set the "estimated" row count
    ScanController compressHeapSC = tc.openScan(
              newHeapConglom,
              false,
              TransactionController.OPENMODE_FORUPDATE,
              TransactionController.MODE_TABLE,
                            TransactionController.ISOLATION_SERIALIZABLE,
              (FormatableBitSet) null,
              (DataValueDescriptor[]) null,
              0,
              (Qualifier[][]) null,
              (DataValueDescriptor[]) null,
              0);
   
    compressHeapSC.setEstimatedRowCount(rowCount);

    compressHeapSC.close();
    compressHeapSC = null; // RESOLVE DJD CLEANUP

    /*
    ** Inform the data dictionary that we are about to write to it.
    ** There are several calls to data dictionary "get" methods here
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

  private int getSemiRowCount(TransactionController tc)
    throws StandardException
  {
    int         numRows = 0;

    ScanController sc = tc.openScan(td.getHeapConglomerateId(),
             false,  // hold
             0,      // open read only
                         TransactionController.MODE_TABLE,
                         TransactionController.ISOLATION_SERIALIZABLE,
             RowUtil.EMPTY_ROW_BITSET, // scanColumnList
             null,  // start position
             ScanController.GE,      // startSearchOperation
             null, // scanQualifier
             null, //stop position - through last row
             ScanController.GT);     // stopSearchOperation

    while (sc.next())
    {
      numRows++;

      // We're only interested in whether the table has 0, 1 or > 1 rows
      if (numRows == 2)
      {
        break;
      }
    }
    sc.close();

    return numRows;
  }
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

    // we skip the estimatedRowCount update.
   
    if (numRows == -1)
      return;
   
    ScanController heapSC = tc.openScan(td.getHeapConglomerateId(),
        false,  // hold
        0,      // openMode: for read
        TransactionController.MODE_RECORD, // locking
        TransactionController.ISOLATION_READ_UNCOMMITTED, //isolation level
        null,   // scancolumnlist-- want everything.
        null,   // startkeyvalue-- start from the beginning.
        0,
        null,   // qualifiers, none!
        null,   // stopkeyvalue,
        0);
   
    try
      heapSC.setEstimatedRowCount(numRows);
    } finally {     
      heapSC.close();
    }

  }
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

                (long[]) null);

    closeBulkFetchScan();

    // Set the "estimated" row count
    ScanController compressHeapSC = tc.openScan(
              newHeapConglom,
              false,
              TransactionController.OPENMODE_FORUPDATE,
              TransactionController.MODE_TABLE,
                            TransactionController.ISOLATION_SERIALIZABLE,
              (FormatableBitSet) null,
              (DataValueDescriptor[]) null,
              0,
              (Qualifier[][]) null,
              (DataValueDescriptor[]) null,
              0);
   
    compressHeapSC.setEstimatedRowCount(rowCount);

    compressHeapSC.close();
    compressHeapSC = null; // RESOLVE DJD CLEANUP

    /*
    ** Inform the data dictionary that we are about to write to it.
    ** There are several calls to data dictionary "get" methods here
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

  private int getSemiRowCount(TransactionController tc)
    throws StandardException
  {
    int         numRows = 0;

    ScanController sc = tc.openScan(td.getHeapConglomerateId(),
             false,  // hold
             0,      // open read only
                         TransactionController.MODE_TABLE,
                         TransactionController.ISOLATION_SERIALIZABLE,
             RowUtil.EMPTY_ROW_BITSET, // scanColumnList
             null,  // start position
             ScanController.GE,      // startSearchOperation
             null, // scanQualifier
             null, //stop position - through last row
             ScanController.GT);     // stopSearchOperation

    while (sc.next())
    {
      numRows++;

      // We're only interested in whether the table has 0, 1 or > 1 rows
      if (numRows == 2)
      {
        break;
      }
    }
    sc.close();

    return numRows;
  }
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

   * @exception StandardException    Thrown on failure
   */
  public List getAllDependencyDescriptorsList()
        throws StandardException
  {
    ScanController         scanController;
    TransactionController      tc;
    ExecRow              outRow;
    ExecRow             templateRow;
    List            ddl = newSList();
    TabInfoImpl            ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
    SYSDEPENDSRowFactory    rf = (SYSDEPENDSRowFactory) ti.getCatalogRowFactory();


    // Get the current transaction controller
    tc = getTransactionCompile();

    outRow = rf.makeEmptyRow();

    scanController = tc.openScan(
      ti.getHeapConglomerate()// conglomerate to open
      false, // don't hold open across commit
      0, // for read
            TransactionController.MODE_TABLE,   // scans entire table.
            TransactionController.ISOLATION_REPEATABLE_READ,
      (FormatableBitSet) null,                     // all fields as objects
      null,   // start position - first row
            ScanController.GE,      // startSearchOperation
      null,
      null,   // stop position - through last row
            ScanController.GT);     // stopSearchOperation

    while (scanController.fetchNext(outRow.getRowArray()))
        {
      DependencyDescriptor    dependencyDescriptor;

      dependencyDescriptor = (DependencyDescriptor)
             rf.buildDescriptor(outRow,
                        (TupleDescriptor) null,
                        this);

      ddl.add(dependencyDescriptor);
        }

        scanController.close();

    return ddl;
  }
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

    ConglomerateController  heapCC;
    ExecIndexRow        indexRow1;
    ExecRow          row;
    DataValueDescriptor      schemaIDOrderable;
    DataValueDescriptor    tableNameOrderable;
    ScanController      scanController;
    TabInfoImpl          ti = coreInfo[SYSTABLES_CORE_NUM];
        SYSTABLESRowFactory    rf = (SYSTABLESRowFactory) ti.getCatalogRowFactory();

    // We only want the 1st column from the heap
    row = exFactory.getValueRow(1);

    /* Use tableNameOrderable and schemaIdOrderable in both start
     * and stop position for scan.
     */
    tableNameOrderable = new SQLVarchar(tableName);
    schemaIDOrderable = new SQLChar(schemaUUID);

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

    heapCC = tc.openConglomerate(
                ti.getHeapConglomerate(), false, 0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_REPEATABLE_READ);

    ExecRow indexTemplateRow = rf.buildEmptyIndexRow( SYSTABLESRowFactory.SYSTABLES_INDEX1_ID, heapCC.newRowLocationTemplate() );

    /* Scan the index and go to the data pages for qualifying rows to
     * build the column descriptor.
     */
    scanController = tc.openScan(
        ti.getIndexConglomerate(SYSTABLESRowFactory.SYSTABLES_INDEX1_ID)// conglomerate to open
        false, // don't hold open across commit
        0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_REPEATABLE_READ,
        (FormatableBitSet) null,         // all fields as objects
        keyRow.getRowArray(),   // start position - first row
        ScanController.GE,      // startSearchOperation
        (ScanQualifier[][]) null, //scanQualifier,
        keyRow.getRowArray(),   // stop position - through last row
        ScanController.GT);     // stopSearchOperation

        /* OK to fetch into the template row,
         * since we won't be doing a next.
         */
    if (scanController.fetchNext(indexTemplateRow.getRowArray()))
    {
      RowLocation  baseRowLocation;


      baseRowLocation = (RowLocationindexTemplateRow.getColumn(
                        indexTemplateRow.nColumns());
 
      /* 1st column is TABLEID (UUID - char(36)) */
      row.setColumn(SYSTABLESRowFactory.SYSTABLES_TABLEID, new SQLChar());
      FormatableBitSet bi = new FormatableBitSet(1);
      bi.set(0);
      boolean base_row_exists =
                heapCC.fetch(
                    baseRowLocation, row.getRowArray(), (FormatableBitSet) null);

            if (SanityManager.DEBUG)
            {
                // it can not be possible for heap row to disappear while
                // holding scan cursor on index at ISOLATION_REPEATABLE_READ.
                SanityManager.ASSERT(base_row_exists, "base row not found");
            }
    }

        scanController.close();
    heapCC.close();

    return uuidFactory.recreateUUID(row.getColumn(1).toString());
  }
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

    if (!isCoreTable)
      faultInTabInfo(ti);

    /* Scan the entire heap */
    ScanController sc =
            tc.openScan(
                ti.getHeapConglomerate(),
                false,
                TransactionController.OPENMODE_FORUPDATE,
                TransactionController.MODE_TABLE,
                TransactionController.ISOLATION_REPEATABLE_READ,
                RowUtil.EMPTY_ROW_BITSET,
                (DataValueDescriptor[]) null,
                ScanController.NA,
                (Qualifier[][]) null,
                (DataValueDescriptor[]) null,
                ScanController.NA);

    while (sc.next())
    {
      /* Replace the column in the table */
      sc.replace(replaceRow, columnsToUpdateSet);
    }

    sc.close();
  }
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

    ConglomerateController  heapCC;
    ExecIndexRow        indexRow1;
    ExecIndexRow      indexTemplateRow;
    ExecRow         outRow;
    RowLocation        baseRowLocation;
    ScanController      scanController;
    TransactionController  tc;
    TupleDescriptor      td = null;

    // Get the current transaction controller
    tc = getTransactionCompile();

    outRow = rf.makeEmptyRow();

    heapCC = tc.openConglomerate(
                ti.getHeapConglomerate(), false, 0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_REPEATABLE_READ);

    /* Scan the index and go to the data pages for qualifying rows to
     * build the column descriptor.
     */
    scanController = tc.openScan(
        ti.getIndexConglomerate(indexId)// conglomerate to open
        false, // don't hold open across commit
        (forUpdate) ? TransactionController.OPENMODE_FORUPDATE : 0,
                TransactionController.MODE_RECORD,
                TransactionController.ISOLATION_REPEATABLE_READ,
        (FormatableBitSet) null,         // all fields as objects
        keyRow.getRowArray(),   // start position - first row
        ScanController.GE,      // startSearchOperation
        scanQualifiers,         //scanQualifier,
        keyRow.getRowArray(),   // stop position - through last row
        ScanController.GT);     // stopSearchOperation

    while (scanController.next())
    {
       // create an index row template
      indexRow1 = getIndexRowFromHeapRow(
                  ti.getIndexRowGenerator(indexId),
                  heapCC.newRowLocationTemplate(),
                  outRow);

      scanController.fetch(indexRow1.getRowArray());

      baseRowLocation = (RowLocationindexRow1.getColumn(
                        indexRow1.nColumns());

            // RESOLVE paulat - remove the try catch block when track 3677 is fixed
            // just leave the contents of the try block
            // adding to get more info on track 3677

            boolean base_row_exists = false;
            try
            {
          base_row_exists =
                    heapCC.fetch(
                        baseRowLocation, outRow.getRowArray(), (FormatableBitSet) null);
            }
            catch (RuntimeException re)
            {
                if (SanityManager.DEBUG)
                {
                    if (re instanceof AssertFailure)
                    {
              StringBuffer strbuf = new StringBuffer("Error retrieving base row in table "+ti.getTableName());
              strbuf.append(": An ASSERT was thrown when trying to locate a row matching index row "+indexRow1+" from index "+ti.getIndexName(indexId)+", conglom number "+ti.getIndexConglomerate(indexId));
                        debugGenerateInfo(strbuf,tc,heapCC,ti,indexId);
                    }
                }
                throw re;
            }
            catch (StandardException se)
            {
                if (SanityManager.DEBUG)
                {
                    // only look for a specific error i.e. that of record on page
                    // no longer exists
                    // do not want to catch lock timeout errors here
                    if (se.getSQLState().equals("XSRS9"))
                    {
              StringBuffer strbuf = new StringBuffer("Error retrieving base row in table "+ti.getTableName());
              strbuf.append(": A StandardException was thrown when trying to locate a row matching index row "+indexRow1+" from index "+ti.getIndexName(indexId)+", conglom number "+ti.getIndexConglomerate(indexId));
                        debugGenerateInfo(strbuf,tc,heapCC,ti,indexId);
                    }
                }
                throw se;
            }

            if (SanityManager.DEBUG)
            {
                // it can not be possible for heap row to disappear while
                // holding scan cursor on index at ISOLATION_REPEATABLE_READ.
        if (! base_row_exists)
        {
          StringBuffer strbuf = new StringBuffer("Error retrieving base row in table "+ti.getTableName());
          strbuf.append(": could not locate a row matching index row "+indexRow1+" from index "+ti.getIndexName(indexId)+", conglom number "+ti.getIndexConglomerate(indexId));
                    debugGenerateInfo(strbuf,tc,heapCC,ti,indexId);
                    // RESOLVE: for now, we are going to kill the VM
                    // to help debug this problem.
                    System.exit(1);

                    // RESOLVE: not currently reached
                    //SanityManager.THROWASSERT(strbuf.toString());
        }
            }

      td = rf.buildDescriptor(outRow, parentTupleDescriptor, this);

      /* If list is null, then caller only wants a single descriptor - we're done
       * else just add the current descriptor to the list.
       */
      if (list == null)
      {
        break;
      }
      else
      {
        list.add(td);
      }
    }
        scanController.close();
    heapCC.close();
    return td;
  }
View Full Code Here

Examples of org.apache.derby.iapi.store.access.ScanController

      throws StandardException
  {
    CatalogRowFactory    rf = ti.getCatalogRowFactory();
    ConglomerateController  heapCC;
    ExecRow         outRow;
    ScanController      scanController;
    TransactionController  tc;
    TupleDescriptor      td = null;

    // Get the current transaction controller
    tc = getTransactionCompile();

    outRow = rf.makeEmptyRow();

    /*
    ** Table scan
    */
    scanController = tc.openScan(
        ti.getHeapConglomerate()// conglomerate to open
        false,             // don't hold open across commit
        0,               // for read
        TransactionController.MODE_TABLE,
                TransactionController.ISOLATION_REPEATABLE_READ,
        (FormatableBitSet) null,         // all fields as objects
        (DataValueDescriptor[]) null,    // start position - first row
        0,              // startSearchOperation - none
        scanQualifiers,     // scanQualifier,
        (DataValueDescriptor[]) null,    // stop position - through last row
        0);             // stopSearchOperation - none

    while (scanController.fetchNext(outRow.getRowArray()))
    {
      td = rf.buildDescriptor(outRow, parentTupleDescriptor, this);

      /* If dList is null, then caller only wants a single descriptor - we're done
       * else just add the current descriptor to the list.
       */
      if (list == null)
      {
        break;
      }
      else
      {
        list.add(td);
      }
    }
    scanController.close();
    return td;
  }
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.