Populating an Array Descriptor
Go Up to Introduction to Arrays
There are four ways to populate an array descriptor:
- Call isc_array_lookup_desc2(), which looks up (in the system metadata tables) and stores in an array descriptor the data type, length, scale, and dimensions for a specified array column in a specified table. This function also stores the table and column name in the descriptor, and initializes itsarray_desc_flagsfield to indicate that the array is to be accessed in row-major order. For example,
isc_array_lookup_desc2( status_vector, &db_handle, /* Set by isc_attach_database() */ &tr_handle, /* Set by isc_start_transaction() */ "PROJ_DEPT_BUDGET", /* table name */ "QUART_HEAD_CNT", /* array column name */ &desc); /* descriptor to be filled in */
- Call isc_array_lookup_bounds2(), which is like a call toisc_array_lookup_desc2(), except thatisc_array_lookup_bounds2() also looks up and stores into the array descriptor the upper and lower bounds of each dimension.
- Call isc_array_set_desc2(), which initializes the descriptor from parameters, rather than by accessing the database metadata. For example,
short dtype = SQL_TEXT; short len = 8; short numdims = 2; isc_array_set_desc2( status_vector, "TABLE1", /* table name */ "CHAR_ARRAY", /* array column name */ &dtype, /* data type of elements */ &len, /* length of each element */ &numdims, /* number of array dimensions */ &desc); /* descriptor to be filled in */
- Set the descriptor fields directly. An example of setting the array_desc_dimensionsfield of the descriptor,desc, is:
desc.array_desc_dimensions = 2;
For complete syntax and information about isc_array_lookup_bounds2(), isc_array_lookup_desc2(), and isc_array_set_desc2(), see API Function Reference.