mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
110 lines
7.8 KiB
HTML
110 lines
7.8 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>Returns the next row from a query as a numeric array</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.oci-fetch-row" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">oci_fetch_row</h1>
|
|
<p class="verinfo">(PHP 5, PHP 7, PECL OCI8 >= 1.1.0)</p><p class="refpurpose"><span class="refname">oci_fetch_row</span> — <span class="dc-title">Returns the next row from a query as a numeric array</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.oci-fetch-row-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>oci_fetch_row</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$statement</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Returns a numerically indexed array containing the next result-set row of a query.
|
|
Each array entry corresponds to a column of the row. This function
|
|
is typically called in a loop until it returns <strong><code>FALSE</code></strong>, indicating
|
|
no more rows exist.
|
|
</p>
|
|
<p class="para">
|
|
Calling <span class="function"><strong>oci_fetch_row()</strong></span> is identical to calling
|
|
<span class="function"><a href="oci_fetch_array.html" class="function">oci_fetch_array()</a></span>
|
|
with <strong><code>OCI_NUM</code></strong>
|
|
+ <strong><code>OCI_RETURN_NULLS</code></strong>.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.oci-fetch-row-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">statement</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">有效的 OCI8 报表标识符
|
|
由 <span class="function"><a href="oci_parse.html" class="function">oci_parse()</a></span> 创建,被 <span class="function"><a href="oci_execute.html" class="function">oci_execute()</a></span>
|
|
或 <em>REF CURSOR</em> statement 标识执行。</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.oci-fetch-row-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns a numerically indexed array. If there are no more rows in
|
|
the <code class="parameter">statement</code> then <strong><code>FALSE</code></strong> is returned.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.oci-fetch-row-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-2433">
|
|
<p><strong>Example #1 <span class="function"><strong>oci_fetch_row()</strong></span> Example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /><br />$conn </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">, </span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">, </span><span style="color: #DD0000">'localhost/XE'</span><span style="color: #007700">);<br />if (!</span><span style="color: #0000BB">$conn</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$e </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_error</span><span style="color: #007700">();<br /> </span><span style="color: #0000BB">trigger_error</span><span style="color: #007700">(</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$e</span><span style="color: #007700">[</span><span style="color: #DD0000">'message'</span><span style="color: #007700">], </span><span style="color: #0000BB">ENT_QUOTES</span><span style="color: #007700">), </span><span style="color: #0000BB">E_USER_ERROR</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">$stid </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">'SELECT department_id, department_name FROM departments'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stid</span><span style="color: #007700">);<br /><br />while ((</span><span style="color: #0000BB">$row </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$stid</span><span style="color: #007700">)) != </span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br /> echo </span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">] . </span><span style="color: #DD0000">" " </span><span style="color: #007700">. </span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">] . </span><span style="color: #DD0000">"<br>\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">oci_free_statement</span><span style="color: #007700">(</span><span style="color: #0000BB">$stid</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 notes" id="refsect1-function.oci-fetch-row-notes">
|
|
<h3 class="title">注释</h3>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
See <span class="function"><a href="oci_fetch_array.html" class="function">oci_fetch_array()</a></span> for more examples of fetching rows.
|
|
</p>
|
|
</p></blockquote>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.oci-fetch-row-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="oci_fetch.html" class="function" rel="rdfs-seeAlso">oci_fetch()</a> - Fetches the next row into result-buffer</span></li>
|
|
<li class="member"><span class="function"><a href="oci_fetch_all.html" class="function" rel="rdfs-seeAlso">oci_fetch_all()</a> - 获取结果数据的所有行到一个数组</span></li>
|
|
<li class="member"><span class="function"><a href="oci_fetch_array.html" class="function" rel="rdfs-seeAlso">oci_fetch_array()</a> - Returns the next row from a query as an associative or numeric array</span></li>
|
|
<li class="member"><span class="function"><a href="oci_fetch_assoc.html" class="function" rel="rdfs-seeAlso">oci_fetch_assoc()</a> - Returns the next row from a query as an associative array</span></li>
|
|
<li class="member"><span class="function"><a href="oci_fetch_object.html" class="function" rel="rdfs-seeAlso">oci_fetch_object()</a> - Returns the next row from a query as an object</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |