<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.6 $ --> <refentry id="function.sqlite-array-query"> <refnamediv> <refname>sqlite_array_query</refname> <refpurpose>Execute a query against a given database and returns an array.</refpurpose> </refnamediv> <refsect1> <title>Description</title> <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> <para> <function>sqlite_array_query</function> is similar to calling <function>sqlite_query</function> and then <function>sqlite_fetch_array</function> for each row of the result set and storing it into an array, as shown in the example below. Calling <function>sqlite_array_query</function> is significantly faster than using such a script. </para> <example> <title><function>sqlite_array_query</function> implemented yourself</title> <programlisting role="php"> <![CDATA[ <?php $q = sqlite_query($dbhandle, "SELECT * from foo LIMIT 100"); $rows = array(); while ($r = sqlite_fetch_array($q)) { $rows[] = $r; } ?> ]]> </programlisting> </example> <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> <para> See also <function>sqlite_query</function>, <function>sqlite_fetch_array</function>, and <function>sqlite_fetch_string</function>. </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 -->