166 lines
9.4 KiB
HTML
166 lines
9.4 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="SQLFreeStmt - Free (or reset) a statement handle" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzadphdapi.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzadpfnfstmt" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>SQLFreeStmt</title>
|
|
</head>
|
|
<body id="rzadpfnfstmt"><a name="rzadpfnfstmt"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">SQLFreeStmt - Free (or reset) a statement handle</h1>
|
|
<div><div class="section"></div>
|
|
<div class="section"><h4 class="sectiontitle">Purpose</h4> <div class="p"><samp class="codeph">SQLFreeStmt()</samp> ends processing
|
|
on the statement referenced by the statement handle. Use this function to:
|
|
<ul><li>Close a cursor</li>
|
|
<li>Reset parameters</li>
|
|
<li>Unbind columns from variables</li>
|
|
<li>Drop the statement handle and free the DB2<sup>®</sup> UDB CLI resources associated with the
|
|
statement handle.</li>
|
|
</ul>
|
|
</div>
|
|
<p><samp class="codeph">SQLFreeStmt()</samp> is called after executing an SQL
|
|
statement and processing the results.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Syntax</h4><pre>SQLRETURN SQLFreeStmt (SQLHSTMT hstmt,
|
|
SQLSMALLINT fOption);</pre>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Function arguments</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><caption>Table 1. SQLFreeStmt arguments</caption><thead align="left"><tr><th align="left" valign="top" width="20%" id="d0e70">Data type</th>
|
|
<th align="left" valign="top" width="20%" id="d0e72">Argument</th>
|
|
<th align="left" valign="top" width="20%" id="d0e74">Use</th>
|
|
<th align="left" valign="top" width="40%" id="d0e76">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="20%" headers="d0e70 ">SQLHSTMT</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e72 "><em>hstmt</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e74 ">Input</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e76 ">Statement handle</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="20%" headers="d0e70 ">SQLSMALLINT</td>
|
|
<td align="left" valign="top" width="20%" headers="d0e72 "><em>fOption</em></td>
|
|
<td align="left" valign="top" width="20%" headers="d0e74 ">Input</td>
|
|
<td align="left" valign="top" width="40%" headers="d0e76 ">Option specifying the manner of freeing the
|
|
statement handle. The option must have one of the following values: <ul><li>SQL_CLOSE</li>
|
|
<li>SQL_DROP</li>
|
|
<li>SQL_UNBIND</li>
|
|
<li>SQL_RESET_PARAMS</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Usage</h4><div class="p"><samp class="codeph">SQLFreeStmt()</samp> can be called
|
|
with the following options: <ul><li>SQL_CLOSE <p>The cursor (if any) associated with the statement handle
|
|
(<em>hstmt</em>) is closed and all pending results are discarded. The application
|
|
can reopen the cursor by calling <samp class="codeph">SQLExecute()</samp> with the same
|
|
or different values in the application variables (if any) that are bound to <em>hstmt</em>.
|
|
The cursor name is retained until the statement handle is dropped or the next
|
|
successful <samp class="codeph">SQLSetCursorName()</samp> call. If no cursor has been
|
|
associated with the statement handle, this option has no effect (no warning
|
|
or error is generated).</p>
|
|
</li>
|
|
<li>SQL_DROP <p>DB2 UDB CLI resources associated with the input statement
|
|
handle are freed, and the handle is invalidated. The open cursor, if any,
|
|
is closed and all pending results are discarded.</p>
|
|
</li>
|
|
<li>SQL_UNBIND <p>All the columns bound by previous <samp class="codeph">SQLBindCol()</samp> calls
|
|
on this statement handle are released (the association between application
|
|
variables or file references and result set columns is broken).</p>
|
|
</li>
|
|
<li>SQL_RESET_PARAMS <p>All the parameters set by previous <samp class="codeph">SQLBindParam()</samp> calls
|
|
on this statement handle are released. The association between application
|
|
variables or file references and parameter markers in the SQL statement of
|
|
the statement handle is broken.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="p">To reuse a statement handle to run a different statement and
|
|
if the previous statement: <ul><li>Was a SELECT, you must close the cursor.</li>
|
|
<li>Used a different number or type of parameters, the parameters must be
|
|
reset.</li>
|
|
<li>Used a different number or type of column bindings, the columns must be
|
|
unbound.</li>
|
|
</ul>
|
|
Alternatively you can drop the statement handle and allocate a new one.</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Return codes</h4><ul><li>SQL_SUCCESS</li>
|
|
<li>SQL_SUCCESS_WITH_INFO</li>
|
|
<li>SQL_ERROR</li>
|
|
<li>SQL_IN_HANDLE</li>
|
|
</ul>
|
|
<p>SQL_SUCCESS_WITH_INFO is not returned if <em>fOption</em> is
|
|
set to SQL_DROP, because there is no statement handle to use when <samp class="codeph">SQLError()</samp> is
|
|
called.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Diagnostics</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="rows"><caption>Table 2. SQLFreeStmt SQLSTATEs</caption><thead align="left"><tr><th align="left" valign="top" width="25%" id="d0e198">SQLSTATE</th>
|
|
<th align="left" valign="top" width="25%" id="d0e200">Description</th>
|
|
<th align="left" valign="top" width="50%" id="d0e202">Explanation</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td align="left" valign="top" width="25%" headers="d0e198 "><strong>40</strong>003 <strong>*</strong></td>
|
|
<td align="left" valign="top" width="25%" headers="d0e200 ">Statement completion unknown</td>
|
|
<td align="left" valign="top" width="50%" headers="d0e202 ">The communication link between the CLI and
|
|
the data source fails before the function completes processing.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="25%" headers="d0e198 "><strong>58</strong>004</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e200 ">System error</td>
|
|
<td align="left" valign="top" width="50%" headers="d0e202 ">Unrecoverable system error.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="25%" headers="d0e198 "><strong>HY</strong>001</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e200 ">Memory allocation failure</td>
|
|
<td align="left" valign="top" width="50%" headers="d0e202 ">The driver is unable to allocate memory required
|
|
to support the processing or completion of the function.</td>
|
|
</tr>
|
|
<tr><td align="left" valign="top" width="25%" headers="d0e198 "><strong>HY</strong>009</td>
|
|
<td align="left" valign="top" width="25%" headers="d0e200 ">Argument value that is not valid</td>
|
|
<td align="left" valign="top" width="50%" headers="d0e202 ">The value specified for the argument <em>fOption</em> is
|
|
not SQL_CLOSE, SQL_DROP, SQL_UNBIND, or SQL_RESET_PARAMS.</td>
|
|
</tr>
|
|
<tr><td valign="top" width="25%" headers="d0e198 "><strong>HY</strong>021</td>
|
|
<td valign="top" width="25%" headers="d0e200 ">Internal descriptor that is not valid </td>
|
|
<td valign="top" width="50%" headers="d0e202 ">The internal descriptor cannot be addressed or allocated,
|
|
or it contains a value that is not valid.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Example</h4></div>
|
|
<div class="example" id="rzadpfnfstmt__xmfstmt"><a name="rzadpfnfstmt__xmfstmt"><!-- --></a><p>Refer to the <samp class="codeph">SQLFetch()</samp> <a href="rzadpfnfetch.htm#rzadpfnfetch__xmfetch">rzadpfnfetch.htm#rzadpfnfetch__xmfetch</a>.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">References</h4><ul><li><a href="rzadpfnastmt.htm#rzadpfnastmt">SQLAllocStmt - Allocate a statement handle</a></li>
|
|
<li><a href="rzadpfnbindc.htm#rzadpfnbindc">SQLBindCol - Bind a column to an application variable</a></li>
|
|
<li><a href="rzadpfnfetch.htm#rzadpfnfetch">SQLFetch - Fetch next row</a></li>
|
|
<li><a href="rzadpfnfconn.htm#rzadpfnfconn">SQLFreeConnect - Free connection handle</a></li>
|
|
<li><a href="rzadpfnspara.htm#rzadpfnspara">SQLSetParam - Set parameter</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzadphdapi.htm" title="This topic provides a description of each CLI function.">DB2 UDB CLI functions</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |