informix
Informix Guide to SQL: Syntax
SQL Statements

ALLOCATE DESCRIPTOR

Use the ALLOCATE DESCRIPTOR statement to allocate memory for a system-descriptor area. This statement creates a place in memory to hold information that a DESCRIBE statement obtains or to hold information about the WHERE clause of a statement.

Use this statement with ESQL/C.

Syntax

Element Purpose Restrictions Syntax
descriptor Quoted string that identifies a system-descriptor area Use single quotes. String must represent the name of an unallocated system-descriptor area. Quoted String, p. 4-260
descriptor_var Host-variable name that identifies a system-descriptor area Variable must contain the name of an unallocated system-descriptor area. Name must conform to language-specific rules for variable names.
items Number of item descriptors in the system-descriptor area The default value is 100. Value must be unsigned INTEGER greater than zero. Literal Number, p. 4-237
items_var Host variable that contains the number of items Data type must be INTEGER or SMALLINT. Name must conform to language-specific rules for variable names.

Usage

The ALLOCATE DESCRIPTOR statement creates a system-descriptor area. A system-descriptor area contains one or more fields called item descriptors. Each item descriptor holds a data value that the database server can receive or send. The item descriptors also contain information about the data such as type, length, scale, precision, and nullability.

If the name that you assign to a system-descriptor area matches the name of an existing system-descriptor area, the database server returns an error. If you free the descriptor with the DEALLOCATE DESCRIPTOR statement, you can reuse the descriptor.

A system-descriptor area holds information that a DESCRIBE...USING SQL DESCRIPTOR statement obtains or it holds information about the WHERE clause of a dynamically executed statement.

WITH MAX Clause

You can use the WITH MAX clause to indicate the maximum number of item descriptors you need. When you use this clause, the COUNT field is set to the number of items you specify. If you do not specify the WITH MAX clause, the default value of the COUNT field is 100. You can change the value of the COUNT field with the SET DESCRIPTOR statement.

The following examples show valid ALLOCATE DESCRIPTOR statements. Each example includes the WITH MAX clause. The first line uses embedded variable names to identify the system-descriptor area and to specify the desired number of item descriptors. The second line uses a quoted string to identify the system-descriptor area and an unsigned integer to specify the desired number of item descriptors.

Related Information

Related statements: DEALLOCATE DESCRIPTOR, DECLARE, DESCRIBE, EXECUTE, FETCH, GET DESCRIPTOR, OPEN, PREPARE, PUT, and SET DESCRIPTOR

For more information on system-descriptor areas, refer to the Informix ESQL/C Programmer's Manual.


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved