sqldsize() — Calculate the Size of an SQL Descriptor Area

Returns the number of bytes required to hold an SQL descriptor area for the specified number of columns.

This function returns a value specifying the number of bytes required:

SYNTAX
int
sqldsize ( ncols )
  int    ncols;    /* INPUT */ 

ncols

The number of columns in an SQL descriptor area.

NOTE

EXAMPLE

This example uses the sqldsize() function to obtain the number of bytes needed to store an SQL descriptor area for nres columns. It then uses the malloc() C run-time library routine to allocate the memory and passes the memory to sqldinit() to initialize the structures:

#include "proesql.h"
struct SQLDA_T *psqlda;
int        nres, nbytes;
            .
            .
            .
nres = 10;
nbytes = sqldsize(nres);

psqlda = (struct SQLDA_T *) malloc(nbytes);
if (psqlda == (struct SQLDA_T *) NULL)
{
    printf( "allocation error\n" );
    return;
}
sqldinit( psqlda, nres );
            .
            .
            . 

SEE ALSO

sqlald() — Allocate Dynamic SQL Descriptor, sqldinit() — Initialize an Allocated SQL Descriptor Area


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095