Package org.apache.derby.iapi.store.access

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


    super.create(
            rawtran, segmentId, input_conglomid, template,
            properties, getTypeFormatId(), temporaryFlag);

        // open the base conglomerate - to get the lock
        ConglomerateController base_cc =
            xact_manager.openConglomerate(
                baseConglomerateId,
                false,
                TransactionController.OPENMODE_FOR_LOCK_ONLY,
                TransactionController.MODE_TABLE,
                TransactionController.ISOLATION_SERIALIZABLE);
       
        OpenBTree open_btree = new OpenBTree();

        BTreeLockingPolicy b2i_locking_policy =
            new B2ITableLocking3(
                rawtran,
                TransactionController.MODE_TABLE,
                rawtran.newLockingPolicy(
                    LockingPolicy.MODE_CONTAINER,
                    TransactionController.ISOLATION_SERIALIZABLE, true),
                base_cc, open_btree);


        // The following call will "open" the new btree.  Create is
        // an interesting case.  What we really want is read only table lock
        // on the base conglomerate and update locks on the index.  For now
        // just get the update lock on the base table, this is done by the
        // lockTable() call made by base class.

        open_btree.init(
            (TransactionManager) xact_manager,  // current user xact
            (TransactionManager) xact_manager,  // current xact
            (ContainerHandle) null,     // have init open the container.
            rawtran,
            false,
            (ContainerHandle.MODE_FORUPDATE),
            TransactionController.MODE_TABLE,
            b2i_locking_policy,         // get table level lock.
            this,                      
            (LogicalUndo) null,         // no logical undo necessary, as
                                        // initEmptyBtree()
                                        // work will be done single user and
                                        // rows will not move.
            (DynamicCompiledOpenConglomInfo) null);
                                       
    // Open the newly created container, and insert the first control row.
        LeafControlRow.initEmptyBtree(open_btree);

        open_btree.close();

        base_cc.close();
  }
View Full Code Here


      throws StandardException {

    TabInfoImpl ti = coreInfo[SYSSCHEMAS_CORE_NUM];
    SYSSCHEMASRowFactory
      rf = (SYSSCHEMASRowFactory)ti.getCatalogRowFactory();
    ConglomerateController
      heapCC = tc.openConglomerate(
        ti.getHeapConglomerate(), false, 0,
        TransactionController.MODE_RECORD,
        TransactionController.ISOLATION_REPEATABLE_READ);

    DataValueDescriptor authIdOrderable = new SQLVarchar(authid);
    ScanQualifier[][] scanQualifier = exFactory.getScanQualifier(1);

    scanQualifier[0][0].setQualifier(
      SYSSCHEMASRowFactory.SYSSCHEMAS_SCHEMAAID - 1/* to zero-based */
      authIdOrderable,
      Orderable.ORDER_OP_EQUALS,
      false,
      false,
      false);

    ScanController sc = tc.openScan(
      ti.getHeapConglomerate(),
      false,   // don't hold open across commit
      0,       // for update
      TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ,
      (FormatableBitSet) null,      // all fields as objects
      (DataValueDescriptor[]) null, // start position -
      0,                            // startSearchOperation - none
      scanQualifier,                //
      (DataValueDescriptor[]) null, // stop position -through last row
      0);                           // stopSearchOperation - none

    boolean result = false;

    try {
      ExecRow outRow = rf.makeEmptyRow();

      if (sc.fetchNext(outRow.getRowArray())) {
        result = true;
      }
    } finally {
      if (sc != null) {
        sc.close();
      }

      if (heapCC != null) {
        heapCC.close();
      }
    }

    return result;
  }
View Full Code Here

  public void drop(TransactionManager xact_manager)
    throws StandardException
  {
        // HACK to get around problem where index is dropped after the base
        // table.
        ConglomerateController base_cc = null;


        /* Get X table lock to make sure no thread is accessing index */
        base_cc =
            lockTable(
                xact_manager,
                TransactionController.OPENMODE_FORUPDATE,
                TransactionController.MODE_TABLE,
                TransactionController.ISOLATION_REPEATABLE_READ);

        xact_manager.getRawStoreXact().dropContainer(id);

        if (base_cc != null)
            base_cc.close();
  }
View Full Code Here

            int            indexId,
            int            indexCol,
            DataValueDescriptor    schemaIdOrderable )
    throws StandardException
  {
    ConglomerateController  heapCC = null;
    ExecIndexRow        indexRow1;
    ExecIndexRow      indexTemplateRow;
    ExecRow         outRow;
    ScanController      scanController = null;
    boolean          foundRow;
    FormatableBitSet          colToCheck = new FormatableBitSet(indexCol);
    CatalogRowFactory    rf = ti.getCatalogRowFactory()

    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(indexId >= 0, "code needs to be enhanced"+
        " to support a table scan to find the index id");
    }

    colToCheck.set(indexCol - 1);

    ScanQualifier[][] qualifier = exFactory.getScanQualifier(1);
    qualifier[0][0].setQualifier
        (indexCol - 1,
         schemaIdOrderable,
         Orderable.ORDER_OP_EQUALS,
         false,
         false,
         false);

    outRow = rf.makeEmptyRow();

    try
    {
      heapCC =
              tc.openConglomerate(
                  ti.getHeapConglomerate(), false, 0,
                    TransactionController.MODE_RECORD,
                    TransactionController.ISOLATION_REPEATABLE_READ);
 
      scanController = tc.openScan(
          ti.getIndexConglomerate(indexId)// conglomerate to open
          false,                 // don't hold open across commit
          0,                                  // for read
                  TransactionController.MODE_RECORD,  // row locking
                    TransactionController.ISOLATION_REPEATABLE_READ,
          colToCheck,             // don't get any rows
          null,                 // start position - first row
          ScanController.GE,            // startSearchOperation
          qualifier,               // scanQualifier,
          null,                 // stop position - through last row
          ScanController.GT);           // stopSearchOperation
 
      foundRow = (scanController.next());
    }
    finally
    {
      if (scanController != null
      {
        scanController.close();
      }
      if (heapCC != null)
      {
        heapCC.close();
      }
    }
   
    return foundRow;
  }
View Full Code Here

   */
  public void  dropTableDescriptor(TableDescriptor td, SchemaDescriptor schema,
                  TransactionController tc)
    throws StandardException
  {
    ConglomerateController  heapCC;
    ExecIndexRow      keyRow1 = null;
    DataValueDescriptor    schemaIDOrderable;
    DataValueDescriptor    tableNameOrderable;
    TabInfoImpl          ti = coreInfo[SYSTABLES_CORE_NUM];

View Full Code Here

   */
  public void updateLockGranularity(TableDescriptor td, SchemaDescriptor schema,
                    char lockGranularity, TransactionController tc)
    throws StandardException
  {
    ConglomerateController  heapCC;
    ExecIndexRow      keyRow1 = null;
    ExecRow            row;
    DataValueDescriptor    schemaIDOrderable;
    DataValueDescriptor    tableNameOrderable;
    TabInfoImpl          ti = coreInfo[SYSTABLES_CORE_NUM];
View Full Code Here

                  String authId,
                  TransactionController tc,
                  int action)
      throws StandardException
  {
    ConglomerateController heapCC = tc.openConglomerate(
      ti.getHeapConglomerate(), false, 0,
      TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ);

    DataValueDescriptor authIdOrderable = new SQLVarchar(authId);
    ScanQualifier[][] scanQualifier = exFactory.getScanQualifier(1);

    scanQualifier[0][0].setQualifier(
      columnNo - 1/* to zero-based */
      authIdOrderable,
      Orderable.ORDER_OP_EQUALS,
      false,
      false,
      false);

    ScanController sc = tc.openScan(
      ti.getIndexConglomerate(rf.SYSROLES_INDEX_ID_EE_OR_IDX),
      false,   // don't hold open across commit
      0,       // for update
      TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ,
      (FormatableBitSet) null,      // all fields as objects
      (DataValueDescriptor[]) null, // start position -
      0,                            // startSearchOperation - none
      scanQualifier,                //
      (DataValueDescriptor[]) null, // stop position -through last row
      0);                           // stopSearchOperation - none

    try {
      ExecRow outRow = rf.makeEmptyRow();
      ExecIndexRow indexRow = getIndexRowFromHeapRow(
        ti.getIndexRowGenerator(rf.SYSROLES_INDEX_ID_EE_OR_IDX),
        heapCC.newRowLocationTemplate(),
        outRow);

      while (sc.fetchNext(indexRow.getRowArray())) {
        if (action == DataDictionaryImpl.EXISTS) {
          return true;
        } else if (action == DataDictionaryImpl.DROP) {
          ti.deleteRow(tc, indexRow,
                 rf.SYSROLES_INDEX_ID_EE_OR_IDX);
        }
      }
    } finally {
      if (sc != null) {
        sc.close();
      }

      if (heapCC != null) {
        heapCC.close();
      }
    }
    return false;
  }
View Full Code Here

  {
    TabInfoImpl ti = getNonCoreTI(catalog);
    PermissionsCatalogRowFactory rf =
      (PermissionsCatalogRowFactory)ti.getCatalogRowFactory();

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

    DataValueDescriptor authIdOrderable = new SQLVarchar(authId);
    ScanQualifier[][] scanQualifier = exFactory.getScanQualifier(1);

    scanQualifier[0][0].setQualifier(
      granteeColnoInIndex - 1/* to zero-based */
      authIdOrderable,
      Orderable.ORDER_OP_EQUALS,
      false,
      false,
      false);

    ScanController sc = tc.openScan(
      ti.getIndexConglomerate(indexNo),
      false,                        // don't hold open across commit
      0,                            // for update
      TransactionController.MODE_RECORD,
      TransactionController.ISOLATION_REPEATABLE_READ,
      (FormatableBitSet) null,      // all fields as objects
      (DataValueDescriptor[]) null, // start position -
      0,                            // startSearchOperation - none
      scanQualifier,                //
      (DataValueDescriptor[]) null, // stop position -through last row
      0);                           // stopSearchOperation - none

    try {
      ExecRow outRow = rf.makeEmptyRow();
      ExecIndexRow indexRow = getIndexRowFromHeapRow(
        ti.getIndexRowGenerator(indexNo),
        heapCC.newRowLocationTemplate(),
        outRow);

      while (sc.fetchNext(indexRow.getRowArray())) {
        RowLocation baseRowLocation = (RowLocation)indexRow.getColumn(
          indexRow.nColumns());

        boolean base_row_exists =
          heapCC.fetch(
            baseRowLocation, outRow.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 doesn't exist");
        }

        if (action == DataDictionaryImpl.EXISTS) {
          return true;
        } else if (action == DataDictionaryImpl.DROP) {
          PermissionsDescriptor perm = (PermissionsDescriptor)rf.
            buildDescriptor(outRow,
                    (TupleDescriptor) null,
                    this);
          removePermEntryInCache(perm);
          ti.deleteRow(tc, indexRow, indexNo);
        }
      }
    } finally {
      if (sc != null) {
        sc.close();
      }

      if (heapCC != null) {
        heapCC.close();
      }
    }
    return false;
  }
View Full Code Here

   * @exception StandardException    Thrown on error
   */
  public void  dropFileInfoDescriptor(FileInfoDescriptor fid)
            throws StandardException
  {
    ConglomerateController  heapCC;
    ExecIndexRow      keyRow1 = null;
    DataValueDescriptor    idOrderable;
    TabInfoImpl          ti = getNonCoreTI(SYSFILES_CATALOG_NUM);
    TransactionController   tc = getTransactionExecute();
   
View Full Code Here

        ScanController.GT);             // stopSearchOperation

    RowLocation          heapLocation =
            heapScan.newRowLocationTemplate();

    ConglomerateController    indexController =
      tc.openConglomerate(
        indexConglomerateNumber,
                false,
        TransactionController.OPENMODE_FORUPDATE,
        TransactionController.MODE_TABLE,
        TransactionController.ISOLATION_REPEATABLE_READ);

    while ( heapScan.fetchNext(heapRow.getRowArray()) )
        {
       heapScan.fetchLocation( heapLocation );

      indexRowGenerator.getIndexRow( heapRow, heapLocation, indexableRow, (FormatableBitSet) null );

      indexController.insert(indexableRow.getRowArray());
    }

    indexController.close();
    heapScan.close();
  }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.store.access.ConglomerateController

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.