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:
sqln
A pointer to the request handle that a previous call to
sqlrequest()
(static),sqldynprep()
(dynamic), orsqldynrq()
(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 withsqln
(if defined) and discards all pending rows, resetting the statement for repeated execution. Setting option to SQL_STMTDROP releasessqln
, 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
- The Progress/ESQL EXEC SQL CLOSE... statement always specifies the SQL_STMTCLS option. To specify the SQL_STMTDROP option, execute
sqldynclose()
directly.- If the statement is a static cursor SELECT statement (cursor specification),
sqldynclose()
always closes the statement according to the SQL_STMTDROP option. The option is ignored.- If the statement is a prepared dynamic ESQL statement or cursor specification, using the SQL_STMTCLS option lets you re-execute the statement associated with
sqln
by callingsqldynexec()
(possibly with a new set of parameter marker values). This option is appropriate when executing an SQL statement many times. You can prepare the statement once, and execute it many times (possibly for each new set of parameter marker values). After the last execution, you can close the statement by specifyingsqldynclose()
with the SQL_STMTDROP option.- Using the SQL_STMTDROP option terminates all access to
sqln
. To re-execute the statement or cursor specification associated withsqln
, prepare it again with a call tosqldynprep()
or invoke the statement with another EXEC SQL PREPARE... statement.- If you prepare a previously prepared dynamic ESQL statement or re-execute a static cursor SELECT statement without closing it, the previous instance of the statement is automatically closed according to the SQL_STMTDROP option.
This example prepares a dynamic cursor specification and later closes the statement (identified by
sql0
), as well as the cursor associated with it:
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 |