Progress
Embedded SQL-92
Guide and Reference
Guidelines for Using an SQLDA
This section provides an outline for using an SQLDA. More information on each step is provided in following sections.
- Allocate an SQLDA by calling the PRO_SQLDA_Allocate function. Do not use a static or stack declaration. The function takes two arguments. The first indicates the maximum number of variables or columns that you expect to handle with this SQLDA object. The second states what the maximum number of bytes is that you wish to reserve for variable or column names when you are fetching data. For input SQLDA’s, the second argument will generally be zero. The server will add 1 to your second argument to take into account the null(0) terminator byte on the name.
- You can reuse an SQLDA structure as long as multiple dynamic SQL statements using the descriptor area are not active at the same time, and the maximum SQLDA size is adequate for every SQL statement using the structure.
- Free an SQLDA by calling the PRO_SQLDA_Deallocate function. This function requires a parameter that is a pointer to the SQLDA structure. Remember that the client application is responsible for returning any memory allocated for the SQLD_VARPTRS and SQLD_IVARPTRS attributes.
- Your ESQLC application must allocate memory for storing the data values returned by the SQL statement and for holding the indicator variables. The application assigns values to the elements of the pointer arrays SQLD_VARPTRS and SQLD_IVARPTRS.
- If you are fetching multiple tuples (rows) in the execution of a single FETCH statement, the application must set the SQLD_ARRAYSZ correctly. The FETCH operation requires that SQLD_VARPTRS [ i ] points to a buffer of size ( SQLD_LENGTHS [ i ] * SQLD_ARRAYSZ ). Assign a null pointer to SQLD_IVARPTRS [ i ] if the statement does not require indicator variables. If the statement does require indicator variables, set SQLD_IVARPTRS [ i ] to point to a storage buffer for indicator variables. The indicator variables (columns) buffer size must be ( sizeof (dh_i32_t) * SQLD_ARRAYSZ ).
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |