-1
1. Frees the existing memory that the loc_buffer field references
2. Reallocates a memory buffer that is large enough to store the expanded TEXT data
3. Assigns the address of this new memory buffer to the loc_buffer field
4. Assigns the size of the new memory buffer to the loc_bufsize field
Each sqlvar_struct structure contains character data for the column name and the column data. When the ESQL/C client application fills this structure, the column name and the column data are in the client code set. When the database server fills this structure (when it executes a DESCRIBE...INTO statement), this character data is in the database code set. When the client application performs code-set conversion between the client and database code sets, the number of bytes that is required to store the column name and column data in the client code set might not equal the number that is required to store this same information in the database code set. Therefore, the size of the character data in sqlvar_struct might increase or decrease during code-set conversion. To handle this possible difference in size, the client application must ensure that it correctly handles the character data in the sqlvar_struct structure. The sqldata Field To hold the column data, the client application must allocate a buffer and set sqldata to point to this buffer. If your client application might perform code-set conversion, it must allocate sufficient storage to handle the increase in the size of the column data that might occur. When the DESCRIBE...INTO statement sets the sqllen field, the sqllen value indicates the length of the column data in the database code set. Therefore, if you use the value of sqllen that the DESCRIBE...INTO statement retrieves, you might not allocate a buffer that is sufficiently large for the data when it is in the client code set. For example, the following code fragment allocates an sqldata buffer with the malloc() system call: