Chapter 9 SQL Statements
381
ALLOCATE DESCRIPTOR statement [ESQL]
Use this statement to allocate space for a SQL descriptor area (SQLDA).
ALLOCATE DESCRIPTOR
descriptor-name
… [ WITH MAX {
integer
|
host-variable
} ]
descriptor-name
:
string
None.
None.
"DEALLOCATE DESCRIPTOR statement" on page 485
"The SQL descriptor area (SQLDA)" on page 45 of the book ASA
Programming Interfaces Guide
WITH MAX clause Allows you to specify the number of variables within
the descriptor area. The default size is one. You must still call fill_sqlda to
allocate space for the actual data items before doing a fetch or any statement
that accesses the data within a descriptor area.
Allocates space for a descriptor area (SQLDA). You must declare the
following in your C code prior to using this statement:
struct sqlda *
descriptor_name
♦ SQL/92 Entry-level feature.
♦
Sybase Supported by Open Client/Open Server.
The following sample program includes an example of ALLOCATE
DESCRIPTOR statement usage.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
EXEC SQL INCLUDE SQLCA;
#include <sqldef.h>
EXEC SQL BEGIN DECLARE SECTION;
int x;
short type;
int numcols;
char string[100];
a_sql_statement_number stmt = 0;
EXEC SQL END DECLARE SECTION;
int main(int argc, char * argv[]){
struct sqlda * sqlda1;
Function
Syntax
Permissions
Side effects
See also
Parameters
Description
Standards and
compatibility
Example