Package org.apache.derby.iapi.sql.execute

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


    UUID          formerUUID,
    int[]          colsToSet,
    TransactionController  tc
  ) throws StandardException
  {
    ExecIndexRow        keyRow1 = null;
    ExecRow              row;
    DataValueDescriptor      IDOrderable;
    DataValueDescriptor      columnNameOrderable;
    TabInfoImpl            ti = getNonCoreTI(SYSTRIGGERS_CATALOG_NUM);
    SYSTRIGGERSRowFactory      rf = (SYSTRIGGERSRowFactory) ti.getCatalogRowFactory();

    /* Use objectID in both start
     * and stop position for index 1 scan.
     */
    IDOrderable = getIDValueAsCHAR(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 SYSTRIGGERS.
    row = rf.makeRow(triggerd, null);

    /*
 
View Full Code Here


    /* Use UUIDStringOrderable in both start and stop positions for scan */
    UUIDStringOrderable = getIDValueAsCHAR(uuid);

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

    return getConstraintDescriptorViaIndex(
          SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX1_ID,
          keyRow,
          ti,
View Full Code Here

    /* Construct keys for both start and stop positions for scan */
    constraintNameOrderable = new SQLVarchar(constraintName);
    UUIDStringOrderable = getIDValueAsCHAR(schemaID);

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

    return getConstraintDescriptorViaIndex(
          SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX2_ID,
          keyRow,
          ti,
View Full Code Here

    List statDescriptorList = newSList();
    DataValueDescriptor UUIDStringOrderable;

    /* set up the start/stop position for the scan */
    UUIDStringOrderable = getIDValueAsCHAR(td.getUUID());
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, UUIDStringOrderable);

    getDescriptorViaIndex(SYSSTATISTICSRowFactory.SYSSTATISTICS_INDEX1_ID,
                              keyRow,
                              (ScanQualifier [][])null,
                              ti,
View Full Code Here

    /* Use tableIDOrderable in both start and stop positions for scan */
    tableIDOrderable = getIDValueAsCHAR(td.getUUID());

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

    keyRow.setColumn(1, tableIDOrderable);

    getConstraintDescriptorViaIndex(
          SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX3_ID,
          keyRow,
          ti,
View Full Code Here

      throws StandardException
  {
    SYSCONSTRAINTSRowFactory rf = (SYSCONSTRAINTSRowFactory) ti.getCatalogRowFactory();
    ConglomerateController  heapCC;
    ConstraintDescriptor  cd = null;
    ExecIndexRow        indexRow1;
    ExecIndexRow      indexTemplateRow;
    ExecRow         outRow;
    RowLocation        baseRowLocation;
    ScanController      scanController;
    TransactionController  tc;
View Full Code Here

                   String schemaUUID,
                   TransactionController tc)
        throws StandardException
  {
    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.
         */
 
View Full Code Here

    throws StandardException
  {
    boolean            isUnique;
    ConglomerateController    cc;
    ExecRow            baseRow;
    ExecIndexRow        indexableRow;
    int              numColumns;
    long            conglomId;
    RowLocation          rl;
    CatalogRowFactory      rf = ti.getCatalogRowFactory();
    IndexRowGenerator      irg;
    ConglomerateDescriptor  conglomerateDescriptor;

    initSystemIndexVariables(ddg, ti, indexNumber);

    irg = ti.getIndexRowGenerator(indexNumber);

    numColumns = ti.getIndexColumnCount(indexNumber);

    /* Is the index unique */
    isUnique = ti.isIndexUnique(indexNumber);

    // create an index row template
    indexableRow = irg.getIndexRowTemplate();

    baseRow = rf.makeEmptyRow();

    // Get a RowLocation template
    cc = tc.openConglomerate(
      heapConglomerateNumber, false, 0,
            TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ);

    rl = cc.newRowLocationTemplate();
    cc.close();

    // Get an index row based on the base row
    irg.getIndexRow(baseRow, rl, indexableRow, (FormatableBitSet) null);

    // Describe the properties of the index to the store using Properties
    // RESOLVE: The following properties assume a BTREE index.
    Properties  indexProperties = ti.getCreateIndexProperties(indexNumber);

    // Tell it the conglomerate id of the base table
    indexProperties.put(
      "baseConglomerateId",
      Long.toString( heapConglomerateNumber ) );

    // All indexes are unique because they contain the RowLocation.
    // The number of uniqueness columns must include the RowLocation
    // if the user did not specify a unique index.
    indexProperties.put("nUniqueColumns",
              Integer.toString(
                isUnique ? numColumns : numColumns + 1));

    // By convention, the row location column is the last column
    indexProperties.put("rowLocationColumn",
              Integer.toString(numColumns));

    // For now, all columns are key fields, including the RowLocation
    indexProperties.put("nKeyFields",
              Integer.toString(numColumns + 1));

    /* Create and add the conglomerate (index) */
    conglomId = tc.createConglomerate(
      "BTREE", // we're requesting an index conglomerate
      indexableRow.getRowArray(),
      null, //default sort order
            null, //default collation id's for collumns in all system congloms
      indexProperties, // default properties
      TransactionController.IS_DEFAULT); // not temporary

View Full Code Here

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

    if (SanityManager.DEBUG) {
      SanityManager.ASSERT
        (isolationLevel ==
         TransactionController.ISOLATION_REPEATABLE_READ ||
         isolationLevel ==
         TransactionController.ISOLATION_READ_UNCOMMITTED);
    }

    outRow = rf.makeEmptyRow();

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

    /* 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,
                isolationLevel,
        (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 (true)
    {
       // create an index row template
      indexRow1 = getIndexRowFromHeapRow(
                  ti.getIndexRowGenerator(indexId),
                  heapCC.newRowLocationTemplate(),
                  outRow);

      // It is important for read uncommitted scans to use fetchNext()
      // rather than fetch, so that the fetch happens while latch is
      // held, otherwise the next() might position the scan on a row,
      // but the subsequent fetch() may find the row deleted or purged
      // from the table.
      if (!scanController.fetchNext(indexRow1.getRowArray())) {
        break;
      }

      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

View Full Code Here

  public static  ExecIndexRow getIndexRowFromHeapRow(IndexRowGenerator irg,
                            RowLocation rl,
                            ExecRow heapRow)
    throws StandardException
  {
    ExecIndexRow    indexRow;

    indexRow = irg.getIndexRowTemplate();
    // Get an index row based on the base row
    irg.getIndexRow(heapRow, rl, indexRow, (FormatableBitSet) null);
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.execute.ExecIndexRow

Copyright © 2018 www.massapicom. 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.