Search in sources :

Example 1 with StorableFormatId

use of org.apache.derby.impl.store.access.StorableFormatId in project derby by apache.

the class ControlRow method getVersion.

/* Private/Protected methods of ControlRow: */
/**
 * Get version of the control row.
 * <p>
 * Returns the version of the control row, faulting it in from the page
 * if necessary.
 *
 * @return version of the control row.
 *
 * @exception  StandardException  Standard exception policy.
 */
protected int getVersion() throws StandardException {
    if (this.version == null) {
        // Fault in the version.
        this.version = new StorableFormatId();
        scratch_row[CR_VERSION_COLID] = this.version;
        fetchDesc.setValidColumns(CR_VERSION_BITSET);
        this.page.fetchFromSlot((RecordHandle) null, CR_SLOT, scratch_row, fetchDesc, false);
    }
    return this.version.getValue();
}
Also used : StorableFormatId(org.apache.derby.impl.store.access.StorableFormatId)

Example 2 with StorableFormatId

use of org.apache.derby.impl.store.access.StorableFormatId 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

StorableFormatId (org.apache.derby.impl.store.access.StorableFormatId)2 Qualifier (org.apache.derby.iapi.store.access.Qualifier)1 AuxObject (org.apache.derby.iapi.store.raw.AuxObject)1 FetchDescriptor (org.apache.derby.iapi.store.raw.FetchDescriptor)1 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)1