SQL Descriptor Area
The SQL descriptor area is used for managing input and output data in dynamically submitted SQL statements where the number and/or data type of the host variables required is not known at the time the program is written.
An SQL descriptor area is allocated with the ESQL statement ALLOCATE DESCRIPTOR and deallocated with DEALLOCATE DESCRIPTOR. See the Mimer SQL Reference Manual, Chapter 12, SQL Statement Descriptions, for more information.
A program may allocate several separate descriptor areas, identified by different descriptor names. SQL descriptor areas are used for both result set list items, routine parameters and input values.
The following statement types can use information from SQL descriptor areas:
- all SELECT statements and calls to result set procedures
- INSERT, DELETE, UPDATE, SET and CALL statements using parameter markers
- ENTER statements.
The following statement types do not use SQL descriptor areas:
- all data definition statements, security control statements, access control statements (except ENTER) and transaction control statements
- INSERT, DELETE, UPDATE and CALL statements using only constant expressions.
In practice, programs using dynamically submitted SQL statements are usually written as though all submitted statements use SQL descriptor areas (since the nature of the submitted statement is not known until run-time).
SQL descriptor areas can be left out of a program only if it is known in advance that they will not be needed (for instance in an application program which will handle only submitted data definition statements).
The Structure of the SQL Descriptor Area
The SQL descriptor area is a storage area holding information about the described statement. It is allocated and maintained with ESQL statements.
It consists of one COUNT field and one or more item descriptor areas, each one describing either a selected column or an input/output value:
COUNT item descriptor area 1 item descriptor area 2 ... item descriptor area n
The COUNT field specifies how many of the item descriptor areas contain data.
The individual fields of the item descriptor area can be accessed with the GET DESCRIPTOR and SET DESCRIPTOR statements. See the Mimer SQL Reference Manual, Chapter 12, SQL Statement Descriptions, for a description of these statements.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40