Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Connection and server management functions [Table of Contents] Backup functions

[-] Chapter 2: The Embedded SQL Interface
[-] Library functions
[-] SQLDA management functions


SQLDA management functions

The following functions are used to manage SQL Descriptor Areas (SQLDAs).

For a detailed description of the SQLDA, see The SQL descriptor area (SQLDA) .


alloc_sqlda_noind function


Prototype

struct sqlda *alloc_sqlda_noind( unsigned numvar );


Description

Allocates a SQLDA with descriptors for numvar variables. The sqln field of the SQLDA is initialized to numvar . Space is not allocated for indicator variables; the indicator pointers are set to the null pointer. A null pointer is returned if memory cannot be allocated.


alloc_sqlda function


Prototype

struct sqlda *alloc_sqlda( unsigned numvar );


Description

Allocates a SQLDA with descriptors for numvar variables. The sqln field of the SQLDA is initialized to numvar . Space is allocated for the indicator variables, the indicator pointers are set to point to this space, and the indicator value is initialized to zero. A null pointer is returned if memory cannot be allocated.


fill_sqlda function


Prototype

struct sqlda *fill_sqlda( struct sqlda *sqlda );


Description

Allocates space for each variable described in each descriptor of sqlda , and assigns the address of this memory to the sqldata field of the corresponding descriptor. Enough space is allocated for the database type and length indicated in the descriptor. Returns sqlda if successful and returns the null pointer if there is not enough memory available.


sqlda_string_length function


Prototype

unsigned long sqlda_string_length( struct sqlda *sqlda, int varno );


Description

Returns the length of the C string (type DT_STRING) that would be required to hold the variable sqlda->sqlvar[varno] (no matter what its type is).


sqlda_storage function


Prototype

unsigned long sqlda_storage( struct sqlda *sqlda, int varno ); 


Description

Returns the amount of storage required to store any value for the variable described in sqlda->sqlvar[varno] .


fill_s_sqlda function


Prototype

struct sqlda *fill_s_sqlda( struct sqlda *sqlda, unsigned int maxlen ); 


Description

Much the same as fill_sqlda, except that it changes all the data types in sqlda to type DT_STRING.. Enough space is allocated to hold the string representation of the type originally specified by the SQLDA, up to a maximum of maxlen bytes. The length fields in the SQLDA ( sqllen ) are modified appropriately. Returns sqlda if successful and returns the null pointer if there is not enough memory available.


free_filled_sqlda function


Prototype

void free_filled_sqlda( struct sqlda *sqlda );


Description

Free the memory allocated to each sqldata pointer. Any null pointer is not freed. The indicator variable space, as allocated in fill_sqlda, is also freed.


free_sqlda_noind function


Prototype

void free_sqlda_noind( struct sqlda *sqlda ); 


Description

Free space that was allocated to this sqlda . You should first call free_filled_sqlda to free the memory referenced by each sqldata pointer. The indicator variable pointers are ignored.


free_sqlda function


Prototype

void free_sqlda( struct sqlda *sqlda ); 


Description

Free the space allocated to this sqlda . You should first call free_filled_sqlda to free the memory referenced by each sqldata pointer. The indicator variable space, as allocated in fill_sqlda , is also freed.


Connection and server management functions [Table of Contents] Backup functions