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

151 lines
8.4 KiB
HTML

<!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>Send a Sybase query and do not block</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.sybase-unbuffered-query" class="refentry">
<div class="refnamediv">
<h1 class="refname">sybase_unbuffered_query</h1>
<p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">sybase_unbuffered_query</span> &mdash; <span class="dc-title">Send a Sybase query and do not block</span></p>
</div>
<div id="function.sybase-unbuffered-query-refsynopsisdiv">
<div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function was
<em class="emphasis">REMOVED</em> in PHP 7.0.0.</p></div>
</div>
<div class="refsect1 description" id="refsect1-function.sybase-unbuffered-query-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>sybase_unbuffered_query</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
, <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$store_result</code></span>
] ) : <span class="type">resource</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>sybase_unbuffered_query()</strong></span> sends a query to the
currently active database on the server that&#039;s associated with the specified
link identifier. If the link identifier isn&#039;t specified, the last
opened link is assumed. If no link is open, the function tries to
establish a link as if <span class="function"><a href="sybase_connect.html" class="function">sybase_connect()</a></span> was
called, and use it.
</p>
<p class="para">
Unlike <span class="function"><a href="sybase_query.html" class="function">sybase_query()</a></span>,
<span class="function"><strong>sybase_unbuffered_query()</strong></span> reads only the first
row of the result set. <span class="function"><a href="sybase_fetch_array.html" class="function">sybase_fetch_array()</a></span> and similar
function read more rows as needed. <span class="function"><a href="sybase_data_seek.html" class="function">sybase_data_seek()</a></span>
reads up to the target row. The behavior may produce better performance
for large result sets.
</p>
<p class="para">
<span class="function"><a href="sybase_num_rows.html" class="function">sybase_num_rows()</a></span> will only return the correct number
of rows if all result sets have been read. To Sybase, the number of rows
is not known and is therefore computed by the client implementation.
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
If you don&#039;t read all of the resultsets prior to executing the next query,
PHP will raise a warning and cancel all of the pending results. To get rid of
this, use <span class="function"><a href="sybase_free_result.html" class="function">sybase_free_result()</a></span> which will cancel pending
results of an unbuffered query.
</p>
</p></blockquote>
</div>
<div class="refsect1 parameters" id="refsect1-function.sybase-unbuffered-query-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">query</code></dt>
<dd>
<p class="para">
</p>
</dd>
<dt>
<code class="parameter">link_identifier</code></dt>
<dd>
<p class="para">
</p>
</dd>
<dt>
<code class="parameter">store_result</code></dt>
<dd>
<p class="para">
The optional <code class="parameter">store_result</code> can be <strong><code>FALSE</code></strong> to
indicate the resultsets shouldn&#039;t be fetched into memory, thus
minimizing memory usage which is particularly interesting with very
large resultsets.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.sybase-unbuffered-query-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns a positive Sybase result identifier on success, or <strong><code>FALSE</code></strong> on
error.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.sybase-unbuffered-query-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-2600">
<p><strong>Example #1 <span class="function"><strong>sybase_unbuffered_query()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$dbh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sybase_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'SYBASE'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$q&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sybase_unbuffered_query</span><span style="color: #007700">(</span><span style="color: #DD0000">'select&nbsp;firstname,&nbsp;lastname&nbsp;from&nbsp;huge_table'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">sybase_data_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$q</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10000</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br />while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sybase_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$q</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">],&nbsp;</span><span style="color: #DD0000">'&nbsp;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #DD0000">'&lt;br&nbsp;/&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$i</span><span style="color: #007700">++&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">40000</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">sybase_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$q</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">sybase_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</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.sybase-unbuffered-query-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">此函数仅适用于对 Sybase 使用 CT 库接口,而不适用于 DB 库。</span></p></blockquote>
</div>
<div class="refsect1 seealso" id="refsect1-function.sybase-unbuffered-query-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="sybase_query.html" class="function" rel="rdfs-seeAlso">sybase_query()</a> - Sends a Sybase query</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>