irchtml Wed Jan 19 08:55:44 2005 EDT
Modified files:
/phpdoc/en/reference/sqlite/functions sqlite-array-query.xml
sqlite-close.xml
sqlite-fetch-all.xml
Log:
add/update examples
http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-array-query.xml?r1=1.9&r2=1.10&ty=u
Index: phpdoc/en/reference/sqlite/functions/sqlite-array-query.xml
diff -u phpdoc/en/reference/sqlite/functions/sqlite-array-query.xml:1.9
phpdoc/en/reference/sqlite/functions/sqlite-array-query.xml:1.10
--- phpdoc/en/reference/sqlite/functions/sqlite-array-query.xml:1.9 Wed Jan
12 03:56:57 2005
+++ phpdoc/en/reference/sqlite/functions/sqlite-array-query.xml Wed Jan 19
08:55:43 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.9 $ -->
+<!-- $Revision: 1.10 $ -->
<refentry id="function.sqlite-array-query">
<refnamediv>
<refname>sqlite_array_query</refname>
@@ -49,7 +49,7 @@
<programlisting role="php">
<![CDATA[
<?php
-$q = sqlite_query($dbhandle, "SELECT * from foo LIMIT 100");
+$q = sqlite_query($dbhandle, "SELECT name, email FROM users LIMIT 25");
$rows = array();
while ($r = sqlite_fetch_array($q)) {
$rows[] = $r;
@@ -59,6 +59,29 @@
</programlisting>
</example>
</para>
+ <para>
+ <example>
+ <title><function>sqlite_array_query</function> example</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]";
+}
+
+/* OO Example */
+$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>
<tip>
<para>
<function>sqlite_array_query</function> is best suited to queries
http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-close.xml?r1=1.4&r2=1.5&ty=u
Index: phpdoc/en/reference/sqlite/functions/sqlite-close.xml
diff -u phpdoc/en/reference/sqlite/functions/sqlite-close.xml:1.4
phpdoc/en/reference/sqlite/functions/sqlite-close.xml:1.5
--- phpdoc/en/reference/sqlite/functions/sqlite-close.xml:1.4 Tue Jul 27
00:48:55 2004
+++ phpdoc/en/reference/sqlite/functions/sqlite-close.xml Wed Jan 19
08:55:43 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<refentry id="function.sqlite-close">
<refnamediv>
<refname>sqlite_close</refname>
@@ -15,7 +15,20 @@
Closes the given <parameter>database</parameter> handle.
If the database was persistent, it will be closed and removed from the
persistent list.
- </para>
+ </para>
+ <para>
+ <example>
+ <title><function>sqlite_close</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$dbhandle = sqlite_open('sqlitedb');
+sqlite_close($dbhandle);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
<para>
See also <function>sqlite_open</function> and
<function>sqlite_popen</function>.
http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-fetch-all.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/sqlite/functions/sqlite-fetch-all.xml
diff -u phpdoc/en/reference/sqlite/functions/sqlite-fetch-all.xml:1.2
phpdoc/en/reference/sqlite/functions/sqlite-fetch-all.xml:1.3
--- phpdoc/en/reference/sqlite/functions/sqlite-fetch-all.xml:1.2 Wed Jan
12 03:56:58 2005
+++ phpdoc/en/reference/sqlite/functions/sqlite-fetch-all.xml Wed Jan 19
08:55:43 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="function.sqlite-fetch-all">
<refnamediv>
<refname>sqlite_fetch_all</refname>
@@ -32,8 +32,44 @@
<methodparam
choice="opt"><type>bool</type><parameter>decode_binary</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
-
- &warn.undocumented.func;
+ <para>
+ <function>sqlite_fetch_all</function> returns an array of the entire result
+ set from the <parameter>result</parameter> resource. It is similar to
calling
+ <function>sqlite_query</function> (or
+ <function>sqlite_unbuffered_query</function>) and then
+ <function>sqlite_fetch_array</function> for each row in the result set.
+ </para>
+ &sqlite.result-type;
+ &sqlite.case-fold;
+ &sqlite.decode-bin;
+ <para>
+ <example>
+ <title><function>sqlite_fetch_all</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$dbhandle = sqlite_open('sqlitedb');
+$query = sqlite_query($dbhandle, "SELECT name, email FROM users LIMIT 25");
+$result = sqlite_fetch_all($query, SQLITE_ASSOC);
+foreach ($result as $entry) {
+ echo "Name: $entry[name] E-mail: $entry[email]";
+}
+
+/* OO Example */
+$dbhandle =& new SQLiteDatabase('sqlitedb');
+
+$query = $dbhandle->query("SELECT name, email FROM users LIMIT 25"); //
buffered result set
+$query = $dbhandle->unbufferedQuery("SELECT name, email FROM users LIMIT 25");
// unbuffered result set
+
+$result = $query->fetchAll(SQLITE_ASSOC);
+foreach ($result as $entry) {
+ echo "Name: $entry[name] E-mail: $entry[email]";
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
</refsect1>
</refentry>