uTools-Manuals/docs/php/sqlsrv_free_stmt.html
2019-04-08 23:22:26 +08:00

101 lines
6.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Frees all resources for the specified statement</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.sqlsrv-free-stmt" class="refentry">
<div class="refnamediv">
<h1 class="refname">sqlsrv_free_stmt</h1>
<p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">sqlsrv_free_stmt</span> &mdash; <span class="dc-title">Frees all resources for the specified statement</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.sqlsrv-free-stmt-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>sqlsrv_free_stmt</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stmt</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
Frees all resources for the specified statement. The statement cannot be used
after <span class="function"><strong>sqlsrv_free_stmt()</strong></span> has been called on it. If
<span class="function"><strong>sqlsrv_free_stmt()</strong></span> is called on an in-progress statement
that alters server state, statement execution is terminated and the statement
is rolled back.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.sqlsrv-free-stmt-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">stmt</code></dt>
<dd>
<p class="para">
The statment for which resources are freed.
Note that <strong><code>NULL</code></strong> is a valid parameter value. This allows the function to be
called multiple times in a script.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.sqlsrv-free-stmt-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.sqlsrv-free-stmt-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-2581">
<p><strong>Example #1 <span class="function"><strong>sqlsrv_free_stmt()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$serverName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"serverName\sqlexpress"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$connectionInfo&nbsp;</span><span style="color: #007700">=&nbsp;array(&nbsp;</span><span style="color: #DD0000">"Database"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"dbName"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"UID"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"username"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"PWD"</span><span style="color: #007700">=&gt;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlsrv_connect</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$serverName</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$connectionInfo</span><span style="color: #007700">);<br />if(&nbsp;</span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die(&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">sqlsrv_errors</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">));<br />}<br /><br /></span><span style="color: #0000BB">$stmt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sqlsrv_query</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;Table_1"</span><span style="color: #007700">);<br />if(&nbsp;</span><span style="color: #0000BB">$stmt&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die(&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">sqlsrv_errors</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">));<br />}<br /><br /></span><span style="color: #FF8000">/*-------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Process&nbsp;query&nbsp;results&nbsp;here.<br />-------------------------------*/<br /><br />/*&nbsp;Free&nbsp;the&nbsp;statement&nbsp;resources.&nbsp;*/<br /></span><span style="color: #0000BB">sqlsrv_free_stmt</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.sqlsrv-free-stmt-notes">
<h3 class="title">注释</h3>
<p class="para">
The main difference between <span class="function"><strong>sqlsrv_free_stmt()</strong></span> and
<span class="function"><a href="sqlsrv_cancel.html" class="function">sqlsrv_cancel()</a></span> is that a statement resource cancelled with
<span class="function"><a href="sqlsrv_cancel.html" class="function">sqlsrv_cancel()</a></span> can be re-executed if it was created with
<span class="function"><a href="sqlsrv_prepare.html" class="function">sqlsrv_prepare()</a></span>. A statement resource cancelled with
<span class="function"><strong>sqlsrv_free_statement()</strong></span> cannot be re-executed.
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.sqlsrv-free-stmt-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="sqlsrv_cancel.html" class="function" rel="rdfs-seeAlso">sqlsrv_cancel()</a> - Cancels a statement</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>