sqldynncols() — Get the Number of Columns in a Result Set

Gets the number of columns in a dynamic ESQL result set.

This function returns normalized values. For more information, see the function return values in the "General Diagnostics" section in this chapter:

SYNTAX
int
sqldynncols ( sqln, ncolumns )
  SQLRQHDL    *sqln;    /* INPUT */
  int          *ncolumns; /* OUTPUT */ 

sqln

A pointer to the request handle that a previous call to sqldynprep() returns. For more information on request handles, see the "SQL Request Handles" section.

ncolumns

A pointer to an integer to receive the number of columns in the result set.

NOTES

EXAMPLE

This example prepares a cursor specification and returns the number of columns in the result set to ncolumns:

#include "proesql.h"
static SQLRQHDL *sql0 = (SQLRQHDL *) 0;
static long      SQLCODE;

int          ncolumns;
            .
            .
            .
sqlcdbind(&SQLCODE, (char *)0);
sqldynprep(&sql0, "SELECT * FROM customer", "STMT5");
if (SQLCODE < 0)
  return;

sqlcdbind(&SQLCODE, (char *)0);
sqldynncols(sql0, &ncolumns);
if (SQLCODE < 0)
{
  printf("Error returning number of columns for SELECT\n");
  sqldynclose(sql0, SQL_STMTDROP);
  return;
} 

SEE ALSO

sqldynnparms() — Get the Number of Parameter Markers, sqldynprep() — Prepare a Dynamic SQL Statement


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