Search in sources :

Example 11 with Qualifier

use of org.apache.derby.iapi.store.access.Qualifier in project derby by apache.

the class BTreeScan method init.

/*
    ** Public Methods of BTreeScan
    */
/**
 *    Initialize the scan for use.
 *    <p>
 *    Any changes to this method may have to be reflected in close as well.
 *    <p>
 *    The btree init opens the container (super.init), and stores away the
 *    state of the qualifiers.  The actual searching for the first position
 *    is delayed until the first next() call.
 *
 *    @exception  StandardException  Standard exception policy.
 */
public void init(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, BTreeLockingPolicy btree_locking_policy, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, BTree conglomerate, LogicalUndo undo, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException {
    super.init(xact_manager, xact_manager, (ContainerHandle) null, rawtran, hold, open_mode, lock_level, btree_locking_policy, conglomerate, undo, dynamic_info);
    this.init_rawtran = rawtran;
    this.init_forUpdate = ((open_mode & ContainerHandle.MODE_FORUPDATE) == ContainerHandle.MODE_FORUPDATE);
    // Keep track of whether this scan should use update locks.
    this.init_useUpdateLocks = ((open_mode & ContainerHandle.MODE_USE_UPDATE_LOCKS) != 0);
    this.init_hold = hold;
    this.init_template = runtime_mem.get_template(getRawTran());
    this.init_scanColumnList = scanColumnList;
    this.init_lock_fetch_desc = RowUtil.getFetchDescriptorConstant(init_template.length - 1);
    if (SanityManager.DEBUG) {
        SanityManager.ASSERT(init_lock_fetch_desc.getMaxFetchColumnId() == (init_template.length - 1));
        SanityManager.ASSERT((init_lock_fetch_desc.getValidColumnsArray())[init_template.length - 1] == 1);
    }
    // note that we don't process qualifiers in btree fetch's
    this.init_fetchDesc = new FetchDescriptor(init_template.length, init_scanColumnList, (Qualifier[][]) null);
    initScanParams(startKeyValue, startSearchOperator, qualifier, stopKeyValue, stopSearchOperator);
    if (SanityManager.DEBUG) {
        SanityManager.ASSERT(TemplateRow.checkColumnTypes(getRawTran().getDataValueFactory(), this.getConglomerate().format_ids, this.getConglomerate().collation_ids, init_template));
    }
    // System.out.println("initializing scan:" + this);
    // initialize default locking operation for the scan.
    this.lock_operation = (init_forUpdate ? ConglomerateController.LOCK_UPD : ConglomerateController.LOCK_READ);
    if (init_useUpdateLocks)
        this.lock_operation |= ConglomerateController.LOCK_UPDATE_LOCKS;
// System.out.println("Btree scan: " + this);
}
Also used : FetchDescriptor(org.apache.derby.iapi.store.raw.FetchDescriptor) Qualifier(org.apache.derby.iapi.store.access.Qualifier)

Example 12 with Qualifier

use of org.apache.derby.iapi.store.access.Qualifier in project derby by apache.

the class ControlRow method getControlRowForPage.

protected static ControlRow getControlRowForPage(ContainerHandle container, Page page) throws StandardException {
    ControlRow cr = null;
    // See if the control row is still cached with the page
    // If so, just use the cached control row.
    AuxObject auxobject = page.getAuxObject();
    if (auxobject != null)
        return (ControlRow) auxobject;
    if (SanityManager.DEBUG)
        SanityManager.ASSERT(page.recordCount() >= 1);
    // No cached control row, so create a new one.
    // Use the version field to determine the type of the row to
    // create.  This routine depends on the version field being the same
    // number column in all control rows.
    StorableFormatId version = new StorableFormatId();
    DataValueDescriptor[] version_ret = new DataValueDescriptor[1];
    version_ret[0] = version;
    // TODO (mikem) - get rid of this new.
    page.fetchFromSlot((RecordHandle) null, CR_SLOT, version_ret, new FetchDescriptor(1, CR_VERSION_BITSET, (Qualifier[][]) null), false);
    // use format id to create empty instance of right Conglomerate class
    cr = (ControlRow) Monitor.newInstanceFromIdentifier(version.getValue());
    cr.page = page;
    // call page specific initialization.
    cr.controlRowInit();
    // cache this Control row with the page in the cache.
    page.setAuxObject(cr);
    return (cr);
}
Also used : AuxObject(org.apache.derby.iapi.store.raw.AuxObject) FetchDescriptor(org.apache.derby.iapi.store.raw.FetchDescriptor) Qualifier(org.apache.derby.iapi.store.access.Qualifier) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) StorableFormatId(org.apache.derby.impl.store.access.StorableFormatId)

Aggregations

Qualifier (org.apache.derby.iapi.store.access.Qualifier)12 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)6 FetchDescriptor (org.apache.derby.iapi.store.raw.FetchDescriptor)4 List (java.util.List)1 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)1 Storable (org.apache.derby.iapi.services.io.Storable)1 StatementContext (org.apache.derby.iapi.sql.conn.StatementContext)1 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)1 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)1 KeyHasher (org.apache.derby.iapi.store.access.KeyHasher)1 AuxObject (org.apache.derby.iapi.store.raw.AuxObject)1 RowLocation (org.apache.derby.iapi.types.RowLocation)1 SQLLongint (org.apache.derby.iapi.types.SQLLongint)1 StorableFormatId (org.apache.derby.impl.store.access.StorableFormatId)1