Search in sources :

Example 6 with DataValueFactory

use of org.apache.derby.iapi.types.DataValueFactory 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);
}
Also used : DataValueFactory(org.apache.derby.iapi.types.DataValueFactory) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) Storable(org.apache.derby.iapi.services.io.Storable) SQLLongint(org.apache.derby.iapi.types.SQLLongint)

Aggregations

DataValueFactory (org.apache.derby.iapi.types.DataValueFactory)6 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)4 DataTypeDescriptor (org.apache.derby.iapi.types.DataTypeDescriptor)2 Properties (java.util.Properties)1 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)1 Storable (org.apache.derby.iapi.services.io.Storable)1 ModuleFactory (org.apache.derby.iapi.services.monitor.ModuleFactory)1 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)1 ColumnDescriptor (org.apache.derby.iapi.sql.dictionary.ColumnDescriptor)1 ColumnDescriptorList (org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList)1 ConglomerateDescriptor (org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor)1 ConstraintDescriptor (org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor)1 ConstraintDescriptorList (org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList)1 DataDictionary (org.apache.derby.iapi.sql.dictionary.DataDictionary)1 SchemaDescriptor (org.apache.derby.iapi.sql.dictionary.SchemaDescriptor)1 TableDescriptor (org.apache.derby.iapi.sql.dictionary.TableDescriptor)1 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)1 ExecutionFactory (org.apache.derby.iapi.sql.execute.ExecutionFactory)1 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)1 ScanController (org.apache.derby.iapi.store.access.ScanController)1