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

185 lines
7.7 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>Execute a query that does not prefetch and buffer all data</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.sqlite-unbuffered-query" class="refentry">
<div class="refnamediv">
<h1 class="refname">sqlite_unbuffered_query</h1>
<h1 class="refname">SQLiteDatabase::unbufferedQuery</h1>
<p class="verinfo">(PHP 5 &lt; 5.4.0, PECL sqlite &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_unbuffered_query</span> -- <span class="refname">SQLiteDatabase::unbufferedQuery</span> &mdash; <span class="dc-title">Execute a query that does not prefetch and buffer all data</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.sqlite-unbuffered-query-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>sqlite_unbuffered_query</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$dbhandle</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$result_type</code><span class="initializer"> = SQLITE_BOTH</span></span>
[, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_msg</code></span>
]] ) : <span class="type">resource</span></div>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>sqlite_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">$dbhandle</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$result_type</code><span class="initializer"> = SQLITE_BOTH</span></span>
[, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_msg</code></span>
]] ) : <span class="type">resource</span></div>
<p class="para rdfs-comment">面向对象风格 (method):</p>
<div class="methodsynopsis dc-description">
<span class="modifier">public</span> <span class="methodname"><strong>SQLiteDatabase::unbufferedQuery</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$result_type</code><span class="initializer"> = SQLITE_BOTH</span></span>
[, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_msg</code></span>
]] ) : <span class="type"><span class="type SQLiteUnbuffered">SQLiteUnbuffered</span></span></div>
<p class="para rdfs-comment">
<span class="function"><strong>sqlite_unbuffered_query()</strong></span> is identical to
<span class="function"><a href="sqlite_query.html" class="function">sqlite_query()</a></span> except that the result that is returned
is a sequential forward-only result set that can only be used to read
each row, one after the other.
</p>
<p class="para">
This function is ideal for generating things such as HTML tables where
you only need to process one row at a time and don&#039;t need to randomly
access the row data.
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
Functions such as <span class="function"><a href="sqlite_seek.html" class="function">sqlite_seek()</a></span>,
<span class="function"><a href="sqlite_rewind.html" class="function">sqlite_rewind()</a></span>, <span class="function"><a href="sqlite_next.html" class="function">sqlite_next()</a></span>,
<span class="function"><a href="sqlite_current.html" class="function">sqlite_current()</a></span>, and
<span class="function"><a href="sqlite_num_rows.html" class="function">sqlite_num_rows()</a></span> do not work on result handles
returned from <span class="function"><strong>sqlite_unbuffered_query()</strong></span>.
</p>
</p></blockquote>
</div>
<div class="refsect1 parameters" id="refsect1-function.sqlite-unbuffered-query-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">dbhandle</code></dt>
<dd>
<p class="para">
The SQLite Database resource; returned from
<span class="function"><a href="sqlite_open.html" class="function">sqlite_open()</a></span> when used procedurally. This parameter
is not required when using the object-oriented method.
</p>
</dd>
<dt>
<code class="parameter">query</code></dt>
<dd>
<p class="para">
The query to be executed.
</p>
<p class="para">
Data inside the query should be <a href="sqlite_escape_string.html" class="link">properly escaped</a>.
</p>
</dd>
<dt>
<code class="parameter">result_type</code></dt>
<dd>
<p class="para">可选的 <code class="parameter">result_type</code>
参数接受常量,且决定返回的数组如何被索引。使用
<strong><code>SQLITE_ASSOC</code></strong> 会仅返回关联索引(已命名字段),而
<strong><code>SQLITE_NUM</code></strong> 会仅返回数值索引。<strong><code>SQLITE_BOTH</code></strong>
会同时返回关联和数值索引。<strong><code>SQLITE_BOTH</code></strong> 是此函数的默认值。</p>
</dd>
<dt>
<code class="parameter">error_msg</code></dt>
<dd>
<p class="para">
The specified variable will be filled if an error occurs. This is
specially important because SQL syntax errors can&#039;t be fetched using
the <span class="function"><a href="sqlite_last_error.html" class="function">sqlite_last_error()</a></span> function.
</p>
</dd>
</dl>
</p>
<blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">为兼容其他数据库扩展(比如 MySQL),支持两种可替代的语法。推荐第一种格式,函数的第一个参数是<code class="parameter">dbhandle</code></span></p></blockquote>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.sqlite-unbuffered-query-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns a result handle 或者在失败时返回 <strong><code>FALSE</code></strong>.
</p>
<p class="para">
<span class="function"><strong>sqlite_unbuffered_query()</strong></span> returns a sequential
forward-only result set that can only be used to read each row, one after
the other.
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.sqlite-unbuffered-query-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>5.1.0</td>
<td>
Added the <code class="parameter">error_msg</code> parameter
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.sqlite-unbuffered-query-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="sqlite_query.html" class="function" rel="rdfs-seeAlso">sqlite_query()</a> - Executes a query against a given database and returns a result handle</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>