sqldynclose() — Close an SQL Statement

Closes a static cursor SELECT or prepared dynamic (cursor or non-cursor) statement. This function supports the EXEC SQL CLOSE... statement.

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

SYNTAX
int
sqldynclose ( sqln, option )
  SQLRQHDL    *sqln;  /* INPUT */
  int          option;  /* INPUT */ 

sqln

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

option

The value of SQL_STMTCLS or SQL_STMTDROP, as defined in the proesql.h header file. Setting option to SQL_STMTCLS closes the cursor associated with sqln (if defined) and discards all pending rows, resetting the statement for repeated execution. Setting option to SQL_STMTDROP releases sqln, frees all resources associated with it, closes the associated cursor (if defined), and discards all pending rows, removing the statement from the ESQL context.

NOTES

EXAMPLE

This example prepares a dynamic cursor specification and later closes the statement (identified by sql0), as well as the cursor associated with it:

#include "proesql.h"
            .
            .
            .
long SQLCODE;
SQLRQHDL *sql0 = (SQLRQHDL *)0;
            .
            .
            .
sqlcdbind(&SQLCODE, (char *)0);
sqldynprep(&sql0, "SELECT * FROM customer", "STMT5");
if (SQLCODE < 0)
  return;
            .
            .
            .
sqlcdbind(&SQLCODE, (char *)0);
sqldynclose(sql0, SQL_STMTDROP);
if (SQLCODE < 0)
{
  printf("Error closing cursor statement\n");
  return;
} 

SEE ALSO

proesql.h, sqldynexec() — Execute a Dynamic SQL Statement, sqldynprep() — Prepare a Dynamic SQL Statement, sqldynrq() — Execute a Dynamic Non-SELECT Statement, sqlrequest() — Execute a Static ESQL Statement


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