Preparing the Array Descriptor

From InterBase

Go Up to Writing Data to an Array

To prepare an array descriptor that specifies the array or array slice to be written to, follow these steps:

1. Create the array descriptor:
2. Fill in the descriptor with information regarding the array column to which data will be written. Do this either by calling one of the functions isc_array_lookup_bounds2(), isc_array_lookup_desc2(), or ­isc_array_set_desc2(), or by directly filling in the descriptor. For information on the contents of array descriptors, and the usage of these functions, see Array Descriptors.

Ensure the descriptor boundaries are set to those of the slice to be written to.

If you want to write to the entire array rather than to just a slice, set the boundaries to the full boundaries as initially declared for the array column. This is guaranteed to be the case if you fill in the descriptor by calling ­isc_array_lookup_bounds2():

isc_array_lookup_bounds2(status_vector, db_handle, &trans,
"PROJ_DEPT_BUDGET", /* table name */
"QUART_HEAD_CNT", /* array column name */

Suppose the array column, QUART_HEAD_CNT, is a one-dimensional array consisting of four elements, and it was declared to have a lower subscript bound of 1 and an upper bound of 4 when it was created. Then after a call to­ isc_array_lookup_bounds2(), the array descriptor fields for the boundaries contain the following information:

desc.array_desc_bounds[0].array_bound_lower == 1 desc.array_desc_bounds[0].array_bound_upper == 4

If you just want to write to or modify a slice of the array, then change the upper and lower bound appropriately. For example, if you just want to write to the first two elements of the array, then modify the upper bound to the value 2:

desc.array_desc_bounds[0].array_bound_upper == 2

Advance To: