Source of: /manual/en/function.sqlite-unbuffered-query.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.sqlite.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.sqlite-unbuffered-query.php',
1 => 'sqlite_unbuffered_query',
),
'up' =>
array (
0 => 'ref.sqlite.php',
1 => 'SQLite Functions',
),
'prev' =>
array (
0 => 'function.sqlite-udf-encode-binary.php',
1 => 'sqlite_udf_encode_binary',
),
'next' =>
array (
0 => 'function.sqlite-valid.php',
1 => 'sqlite_valid',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<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, PECL sqlite >= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_unbuffered_query</span> -- <span class="refname">SQLiteDatabase->unbufferedQuery</span> — <span class="dc-title">Execute a query that does not prefetch and buffer all data</span></p>
</div>
<a name="function.sqlite-unbuffered-query.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">resource</span> <span class="methodname"><b>sqlite_unbuffered_query</b></span>
( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$dbhandle</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$query</tt></span>
[, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$result_type</tt></span>
[, <span class="methodparam"><span class="type">string</span> <tt class="parameter reference">&$error_msg</tt></span>
]] )</div>
<div class="methodsynopsis dc-description">
<span class="type">resource</span> <span class="methodname"><b>sqlite_unbuffered_query</b></span>
( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$query</tt></span>
, <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$dbhandle</tt></span>
[, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$result_type</tt></span>
[, <span class="methodparam"><span class="type">string</span> <tt class="parameter reference">&$error_msg</tt></span>
]] )</div>
<p class="para rdfs-comment">Object oriented style (method):</p>
<div class="classsynopsis">
<div class="ooclass"><b class="classname">SQLiteDatabase</b></div>
<div class="methodsynopsis dc-description">
<span class="type">SQLiteUnbuffered</span> <span class="methodname"><b>unbufferedQuery</b></span>
( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$query</tt></span>
[, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$result_type</tt></span>
[, <span class="methodparam"><span class="type">string</span> <tt class="parameter reference">&$error_msg</tt></span>
]] )</div>
</div>
<p class="para">
<b>sqlite_unbuffered_query()</b> is identical to
<a href="function.sqlite-query.php" class="function">sqlite_query()</a> 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't need to randomly
access the row data.
</p>
<blockquote><p><b class="note">Note</b>:
Functions such as <a href="function.sqlite-seek.php" class="function">sqlite_seek()</a>,
<a href="function.sqlite-rewind.php" class="function">sqlite_rewind()</a>, <a href="function.sqlite-next.php" class="function">sqlite_next()</a>,
<a href="function.sqlite-current.php" class="function">sqlite_current()</a>, and
<a href="function.sqlite-num-rows.php" class="function">sqlite_num_rows()</a> do not work on result handles
returned from <b>sqlite_unbuffered_query()</b>.
<br />
</p></blockquote>
</div>
<a name="function.sqlite-unbuffered-query.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">dbhandle</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The SQLite Database resource; returned from
<a href="function.sqlite-open.php" class="function">sqlite_open()</a> when used procedurally. This parameter
is not required when using the object-oriented method.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">query</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The query to be executed.
</p>
<p class="para">
Data inside the query should be <a href="function.sqlite-escape-string.php" class="link">properly escaped</a>.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">result_type</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">The optional <i><tt class="parameter">result_type</tt></i>
parameter accepts a constant and determines how the returned array will be
indexed. Using <b><tt class="constant">SQLITE_ASSOC</tt></b> will return only associative
indices (named fields) while <b><tt class="constant">SQLITE_NUM</tt></b> will return
only numerical indices (ordinal field numbers). <b><tt class="constant">SQLITE_BOTH</tt></b>
will return both associative and numerical indices.
<b><tt class="constant">SQLITE_BOTH</tt></b> is the default for this function.</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">error_msg</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
The specified variable will be filled if an error occurs. This is
specially important because SQL syntax errors can't be fetched using
the <a href="function.sqlite-last-error.php" class="function">sqlite_last_error()</a> function.
</p>
</dd>
</dl>
<p>
</p>
<blockquote><p><b class="note">Note</b>: <span class="simpara">Two alternative syntaxes are
supported for compatibility with other database extensions (such as MySQL).
The preferred form is the first, where the <i><tt class="parameter">dbhandle</tt></i>
parameter is the first parameter to the function.</span></p></blockquote>
</div>
<a name="function.sqlite-unbuffered-query.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns a result handle or <b><tt class="constant">FALSE</tt></b> on failure.
</p>
<p class="para">
<b>sqlite_unbuffered_query()</b> returns a sequential
forward-only result set that can only be used to read each row, one after
the other.
</p>
</div>
<a name="function.sqlite-unbuffered-query.changelog"></a><div class="refsect1 changelog">
<h3 class="title">Changelog</h3>
<p class="para">
</p><table class="doctable informaltable">
<thead valign="middle">
<tr valign="middle">
<th>Version</th>
<th>Description</th>
</tr>
</thead>
<tbody valign="middle" class="tbody">
<tr valign="middle">
<td align="left">5.1.0</td>
<td align="left">
Added the <i><tt class="parameter">error_msg</tt></i>
parameter
</td>
</tr>
</tbody>
</table>
<p>
</p>
</div>
<a name="function.sqlite-unbuffered-query.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="function.sqlite-query.php" class="function" rel="rdfs-seeAlso">sqlite_query()</a> - Executes a query against a given database and returns a result handle</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>