php-doc-en/reference/sqlite/functions/sqlite-array-query.xml
Jakub Vrana f9c911174d Remove WS inside <function>
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@197559 c90b9560-bf6c-de11-be94-00142212c4b1
2005-10-04 15:11:18 +00:00

167 lines
5.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<refentry id="function.sqlite-array-query">
<refnamediv>
<refname>sqlite_array_query</refname>
<refname>SQLiteDatabase->arrayQuery</refname>
<refpurpose>Execute a query against a given database and returns an array</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>sqlite_array_query</methodname>
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>decode_binary</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>array</type><methodname>sqlite_array_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>decode_binary</parameter></methodparam>
</methodsynopsis>
<para>Object oriented style (method):</para>
<classsynopsis>
<ooclass><classname>SQLiteDatabase</classname></ooclass>
<methodsynopsis>
<type>array</type><methodname>arrayQuery</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>decode_binary</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
<function>sqlite_array_query</function> executes the given query and returns
an array of the entire result set. It is similar to calling <function>
sqlite_query</function> and then <function>sqlite_fetch_array</function>
for each row in the result set. <function>sqlite_array_query</function> is
significantly faster than the aforementioned.
</para>
<tip>
<para>
<function>sqlite_array_query</function> is best suited to queries
returning 45 rows or less. If you have more data than that, it is
recommended that you write your scripts to use
<function>sqlite_unbuffered_query</function> instead for more optimal
performance.
</para>
</tip>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
The query to be executed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>dbhandle</parameter></term>
<listitem>
<para>
The SQLite Database resource; returned from <function>sqlite_open</function>
when used procedurally. This parameter is not required
when using the object-oriented method.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>result_type</parameter></term>
<listitem>
&sqlite.result-type;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>decode_binary</parameter></term>
<listitem>
&sqlite.decode-bin;
</listitem>
</varlistentry>
</variablelist>
</para>
&sqlite.param-compat;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array of the entire result set; &false; otherwise.
</para>
&sqlite.case-fold;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Procedural style</title>
<programlisting role="php">
<![CDATA[
<?php
$dbhandle = sqlite_open('sqlitedb');
$result = sqlite_array_query($dbhandle, 'SELECT name, email FROM users LIMIT 25', SQLITE_ASSOC);
foreach ($result as $entry) {
echo 'Name: ' . $entry['name'] . ' E-mail: ' . $entry['email'];
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Object-oriented style</title>
<programlisting role="php">
<![CDATA[
<?php
$dbhandle = new SQLiteDatabase('sqlitedb');
$result = $dbhandle->arrayQuery('SELECT name, email FROM users LIMIT 25', SQLITE_ASSOC);
foreach ($result as $entry) {
echo 'Name: ' . $entry['name'] . ' E-mail: ' . $entry['email'];
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlite_query</function></member>
<member><function>sqlite_fetch_array</function></member>
<member><function>sqlite_fetch_string</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->