use of org.apache.derby.catalog.IndexDescriptor 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;
}
Aggregations