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();
}
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);
}
Aggregations