use of org.apache.derby.iapi.types.SQLLongint in project derby by apache.
the class SYSCONGLOMERATESRowFactory method makeRow.
/**
* Make a SYSCONGLOMERATES row
*
* @return Row suitable for inserting into SYSCONGLOMERATES.
*
* @exception StandardException thrown on failure
*/
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
ExecRow row;
DataValueDescriptor col;
String tabID = null;
Long conglomNumber = null;
String conglomName = null;
Boolean supportsIndex = null;
IndexRowGenerator indexRowGenerator = null;
Boolean supportsConstraint = null;
String conglomUUIDString = null;
String schemaID = null;
ConglomerateDescriptor conglomerate = (ConglomerateDescriptor) td;
if (td != null) {
/* Sometimes the SchemaDescriptor is non-null and sometimes it
* is null. (We can't just rely on getting the schema id from
* the ConglomerateDescriptor because it can be null when
* we are creating a new conglomerate.
*/
if (parent != null) {
SchemaDescriptor sd = (SchemaDescriptor) parent;
schemaID = sd.getUUID().toString();
} else {
schemaID = conglomerate.getSchemaID().toString();
}
tabID = conglomerate.getTableID().toString();
conglomNumber = conglomerate.getConglomerateNumber();
conglomName = conglomerate.getConglomerateName();
conglomUUIDString = conglomerate.getUUID().toString();
supportsIndex = conglomerate.isIndex();
indexRowGenerator = conglomerate.getIndexDescriptor();
supportsConstraint = conglomerate.isConstraint();
}
/* RESOLVE - It would be nice to require less knowledge about sysconglomerates
* and have this be more table driven.
*/
/* Build the row to insert */
row = getExecutionFactory().getValueRow(SYSCONGLOMERATES_COLUMN_COUNT);
/* 1st column is SCHEMAID (UUID - char(36)) */
row.setColumn(1, new SQLChar(schemaID));
/* 2nd column is TABLEID (UUID - char(36)) */
row.setColumn(2, new SQLChar(tabID));
/* 3rd column is CONGLOMERATENUMBER (long) */
row.setColumn(3, new SQLLongint(conglomNumber));
/* 4th column is CONGLOMERATENAME (varchar(128))
** If null, use the tableid so we always
** have a unique column
*/
row.setColumn(4, (conglomName == null) ? new SQLVarchar(tabID) : new SQLVarchar(conglomName));
/* 5th column is ISINDEX (boolean) */
row.setColumn(5, new SQLBoolean(supportsIndex));
/* 6th column is DESCRIPTOR
* (user type org.apache.derby.catalog.IndexDescriptor)
*/
row.setColumn(6, new UserType((indexRowGenerator == null ? (IndexDescriptor) null : indexRowGenerator.getIndexDescriptor())));
/* 7th column is ISCONSTRAINT (boolean) */
row.setColumn(7, new SQLBoolean(supportsConstraint));
/* 8th column is CONGLOMERATEID (UUID - char(36)) */
row.setColumn(8, new SQLChar(conglomUUIDString));
return row;
}
use of org.apache.derby.iapi.types.SQLLongint in project derby by apache.
the class BranchRow method createBranchRowFromOldLeafRow.
/**
* Create a new branch row, given a old leaf row and a new child page.
* Used by LeafControlRow to manufacture new branch rows when splitting
* or growing the tree.
*
* There is no way to "copy" values of a template row, so this class just
* stores a referece to the Indexable row passed in. This is ok as all
* usages of this class when instantiated this way, have an old leaf row
* from which they are creating a new branch row with the same key values,
* and a different child page number.
*
* WARNING - this branch row is only valid while the old leaf row is
* valid, as it contains references to the columns of the old leaf row.
* So use of the row should only provide read-only access to the objects
* of the old leaf row which are referenced.
*/
public static BranchRow createBranchRowFromOldLeafRow(DataValueDescriptor[] leafrow, long childpageno) {
BranchRow newbranch = new BranchRow();
/* create new object array for the row, and copy all object references
* from old leaf row to new branch row.
*/
newbranch.branchrow = new DataValueDescriptor[leafrow.length + 1];
System.arraycopy(leafrow, 0, newbranch.branchrow, 0, leafrow.length);
/* now create a different child page pointer object and place it as
* last column in the new branch row.
*/
newbranch.branchrow[newbranch.branchrow.length - 1] = new SQLLongint(childpageno);
return (newbranch);
}
use of org.apache.derby.iapi.types.SQLLongint in project derby by apache.
the class ControlRow method getParentPageNumber.
/**
* Get the page number of the parent, if it's being maintained.
* Note that there is intentionally no way to get the control
* row for the parent page - the b-tree code NEVER traverses
* up the tree, even in consistency checks.
*
* @exception StandardException Standard exception policy.
*/
protected long getParentPageNumber() throws StandardException {
if (this.parentPageNumber == null) {
// Fault in the page number.
this.parentPageNumber = new SQLLongint();
scratch_row[CR_PARENT_COLID] = this.parentPageNumber;
fetchDesc.setValidColumns(CR_PARENT_BITSET);
this.page.fetchFromSlot((RecordHandle) null, CR_SLOT, scratch_row, fetchDesc, false);
}
// See NOTE3 about converting from int to long.
long pageno = parentPageNumber.getLong();
return pageno;
}
use of org.apache.derby.iapi.types.SQLLongint in project derby by apache.
the class ControlRow method getrightSiblingPageNumber.
/**
* Get the page number of the right sibling. Fault it's value in if it
* hasn't been yet.
*
* @exception StandardException Standard exception policy.
*/
protected long getrightSiblingPageNumber() throws StandardException {
if (this.rightSiblingPageNumber == null) {
// Fault in the page number.
this.rightSiblingPageNumber = new SQLLongint();
scratch_row[CR_RIGHTSIB_COLID] = this.rightSiblingPageNumber;
fetchDesc.setValidColumns(CR_RIGHTSIB_BITSET);
this.page.fetchFromSlot((RecordHandle) null, CR_SLOT, scratch_row, fetchDesc, false);
}
return (rightSiblingPageNumber.getLong());
}
use of org.apache.derby.iapi.types.SQLLongint in project derby by apache.
the class ControlRow method getIsRoot.
protected boolean getIsRoot() throws StandardException {
if (this.isRoot == null) {
// Fault in the level
this.isRoot = new SQLLongint();
scratch_row[CR_ISROOT_COLID] = this.isRoot;
fetchDesc.setValidColumns(CR_ISROOT_BITSET);
this.page.fetchFromSlot((RecordHandle) null, CR_SLOT, scratch_row, fetchDesc, false);
}
return ((this.isRoot.getLong() == 1));
}
Aggregations