isc_array_set_desc2()
Go Up to API Function Reference
Initializes an array descriptor.
Syntax
ISC_STATUS isc_array_set_desc2(
ISC_STATUS *status_vector,
char *table_name,
char *column_name,
short *sql_dtype,
short *sql_length,
short *dimensions,
ISC_ARRAY_DESC_V2 *desc);
Parameter | Type | Description |
---|---|---|
|
|
Pointer to the error status vector |
|
|
Blank- or null-terminated name of the table containing the array column, <column_name> |
|
|
Name of the array column; this may be either null-terminated or blank-terminated. |
|
|
Pointer to SQL data type of the array elements |
|
|
Pointer to length of each array element |
|
|
Pointer to number of array dimensions |
|
|
Array descriptor to be filled in by this function |
Description
isc_array_set_desc2()
initializes the array descriptor, desc
, from the function parameters, table_name
, column_name
, sql_dtype
, sql_length
, and dimensions
.
isc_array_set_desc2()
also sets to 0 a flag in the descriptor. This specifies that the array is accessed in future function calls in row-major order, the default. If an application requires column-major access, reset this flag to 1.
table_name
and column_name
can be either null-terminated or blank-terminated. The names stored in the descriptor will be null-terminated.
sql_dtype
must be given as a SQL macro constant.
The array descriptor is used in subsequent calls to isc_array_get_slice2()
or isc_array_put_slice2()
.
For a detailed description of the array descriptor, see Working with Array Data.
- Note: There are ways to fill in an array descriptor other than by calling
isc_array_set_desc2
(). You can also:
- Call
isc_array_lookup_bounds2()
. This function is similar to isc_array_lookup_desc2()
, except thatisc_array_lookup_bounds2()
also fills in information about the upper and lower bounds of each dimension. - Call
isc_array_lookup_desc2()
. This function is similar to isc_array_lookup_bounds2()
, except thatisc_array_lookup_desc2()
does not fill in information about the upper and lower bounds of each dimension. - Set the descriptor fields directly.
- You must set
array_desc_version
toARR_DESC_CURRENT_VERSION
. - The
array_desc_field_name
andarray_desc_relation_name
parameters must be null-terminated: array_desc_dtype
must be expressed as one of the data types in the following table:
- You must set
array_desc_dtype | Corresponding InterBase data type |
---|---|
blr_boolean_dtype |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
The following illustrates a sample call to isc_array_set_desc2()
. More complete examples of accessing arrays are found in the example programs for isc_array_get_slice2()
and isc_array_put_slice2()
.
#include <ibase.h> ISC_STATUS status_vector[20]; ISC_ARRAY_DESC_V2 desc; short dtype = SQL_TEXT; short len = 8; short dims = 1; isc_array_set_desc2( status_vector, "TABLE1", "CHAR_ARRAY", &dtype, &len, &dims, &desc); if (status_vector[0] == 1 && status_vector[1]){ /* Process error. */ isc_print_status(status_vector); return(1); }
Return value
isc_array_set_desc2()
returns the second element of the status vector. Zero indicates success. A nonzero value indicates an error. For InterBase errors, the first element of the status vector is set to 1, and the second element is set to an InterBase error code.
To check for an InterBase error, examine the first two elements of the status vector directly. For more information about examining the status vector, see Handling Error Conditions.