sqldynnparms() — Get the Number of Parameter Markers

Gets the number of parameter markers in a prepared dynamic ESQL statement.

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

SYNTAX
int
sqldynnparms ( sqln, nparms )
  SQLRQHDL    *sqln;     /* INPUT */
  int          *nparms;      /* 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.

nparms

A pointer to an integer to receive the number of parameter markers in the prepared statement.

NOTES

EXAMPLE

This example prepares a cursor specification and returns the number of dynamic parameter markers in the WHERE clause to nparams.

The parameter markers in the request are hard-coded to show their presence. In reality, the request string might be conditionally assembled from several code points, making the presence and number of parameter markers truly unknown when the request is prepared:

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

int          nparams;
            .
            .
            .
sqlcdbind(&SQLCODE, (char *)0);
sqldynprep(&sql0, "SELECT * FROM customer WHERE name = ?", "STMT5");
if (SQLCODE < 0)
  return;
            .
            .
            .
sqlcdbind(&SQLCODE, (char *)0);
sqldynnparms(sql0, &nparams);
if (SQLCODE < 0)
{
  rintf("Error returning number of parameter markers\n");
  sqldynclose(sql0, SQL_STMTDROP);
  return;
} 

SEE ALSO

sqldynncols() — Get the Number of Columns in a Result Set, sqldynprep() — Prepare a Dynamic SQL Statement, sqlgetrqhdl() — Get a Dynamic Request Handle


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