use of org.apache.derby.iapi.services.io.Storable in project derby by apache.
the class TemplateRow method allocate_objects.
/* Private/Protected methods of This class: */
/**
* Allocate new objects to array based on format id's and column_list.
* <p>
*
* @param num_cols_to_allocate The number of columns to allocate for array.
* @param column_list description of partial set of columns to
* built as described in RowUtil. If null do
* all the columns.
* @param format_ids An array of format ids representing every
* column in the table. column_list describes
* which of these columns to populate into the
* columns array.
*
* @exception StandardException Standard exception policy.
*/
private static DataValueDescriptor[] allocate_objects(Transaction rawtran, int num_cols_to_allocate, FormatableBitSet column_list, int[] format_ids, int[] collation_ids) throws StandardException {
DataValueDescriptor[] ret_row = new DataValueDescriptor[num_cols_to_allocate];
int num_cols = (column_list == null ? format_ids.length : column_list.size());
DataValueFactory dvf = rawtran.getDataValueFactory();
for (int i = 0; i < num_cols; i++) {
// does caller want this column?
if ((column_list != null) && (!column_list.get(i))) {
// no - column should be skipped.
} else {
// yes - create the column
// get empty instance of object identified by the format id.
ret_row[i] = dvf.getNull(format_ids[i], collation_ids[i]);
if (SanityManager.DEBUG) {
DataValueDescriptor o = ret_row[i];
if (o == null) {
SanityManager.THROWASSERT("obj from DataValueFactory.newNull(" + format_ids[i] + ", " + collation_ids[i] + ") null." + ";src column position = " + i + ";dest column position = " + i + ";num_cols = " + num_cols + ";format_ids.length = " + format_ids.length);
}
if (!(o instanceof Storable))
SanityManager.THROWASSERT("object:(" + o.getClass() + "):(" + o + ") not an instanceof Storable");
}
}
}
return (ret_row);
}
Aggregations