cvs: phpdoc /en/reference/sqlite/functions sqlite-busy-timeout.xml sqlite-changes.xml sqlite-exec.xml sqlite-factory.xml sqlite-num-rows.xml
sqlite-open.xml
| From: | Kenneth Schwartz | Date: | Fri, 14 Jan 2005 05:42:48 +0000 |
| Subject: | cvs: phpdoc /en/reference/sqlite/functions sqlite-busy-timeout.xml sqlite-changes.xml sqlite-exec.xml sqlite-factory.xml sqlite-num-rows.xml sqlite-open.xml |
||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969365967@lists.php.net to get a copy of this message | ||
irchtml Fri Jan 14 00:42:48 2005 EDT
Modified files:
/phpdoc/en/reference/sqlite/functions sqlite-busy-timeout.xml
sqlite-changes.xml
sqlite-exec.xml
sqlite-factory.xml
sqlite-num-rows.xml
sqlite-open.xml
Log:
Add/Update examples (incorp. user notes)
http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml:1.6 phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml:1.7 --- phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml:1.6 Wed Jan 12 03:56:57 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml Fri Jan 14 00:42:47 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="function.sqlite-busy-timeout"> <refnamediv> <refname>sqlite_busy_timeout</refname> @@ -34,6 +34,24 @@ PHP sets the default busy timeout to be 60 seconds when the database is opened. </para> + <para> + <example> + <title><function>sqlite_busy_timeout</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_open('sqlitedb'); +sqlite_busy_timeout($dbhandle, 10000); // set timeout to 10 seconds +sqlite_busy_timeout($dbhandle, 0); // disable busy handler + +/* OO Example */ +$dbhandle = new SQLiteDatabase('sqlitedb'); +$dbhandle->busyTimeout(10000); // 10 seconds +$dbhandle->busyTimeout(0); // disable +?>]]> + </programlisting> + </example> + </para> <note> <para> There are one thousand (1000) milliseconds in one second. http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-changes.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-changes.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-changes.xml:1.7 phpdoc/en/reference/sqlite/functions/sqlite-changes.xml:1.8 --- phpdoc/en/reference/sqlite/functions/sqlite-changes.xml:1.7 Wed Jan 12 03:56:57 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-changes.xml Fri Jan 14 00:42:47 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry id="function.sqlite-changes"> <refnamediv> <refname>sqlite_changes</refname> @@ -29,6 +29,33 @@ handle. </para> <para> + <example> + <title><function>sqlite_changes</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_open('mysqlitedb'); +$query = sqlite_query($dbhandle, "UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', sqlite_changes($dbhandle); +} + +/* OO Example */ +$dbhandle =& new SQLiteDatabase('mysqlitedb'); +$query = $dbhandle->query("UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', $dbhandle->changes(); +} + +?>]]> + </programlisting> + </example> + </para> + <para> See also <function>sqlite_num_rows</function>. </para> </refsect1> http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-exec.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-exec.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-exec.xml:1.5 phpdoc/en/reference/sqlite/functions/sqlite-exec.xml:1.6 --- phpdoc/en/reference/sqlite/functions/sqlite-exec.xml:1.5 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-exec.xml Fri Jan 14 00:42:47 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="function.sqlite-exec"> <refnamediv> <refname>sqlite_exec</refname> @@ -42,6 +42,33 @@ loaded from a file or have embedded in a script. </simpara> </warning> + <para> + <example> + <title><function>sqlite_exec</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_open('mysqlitedb'); +$query = sqlite_exec($dbhandle, "UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', sqlite_changes($dbhandle); +} + +/* OO Example */ +$dbhandle =& new SQLiteDatabase('mysqlitedb'); +$query = $dbhandle->exec("UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', $dbhandle->changes(); +} + +?>]]> + </programlisting> + </example> + </para> &sqlite.param-compat; <para> See also <function>sqlite_query</function>, http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-factory.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-factory.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-factory.xml:1.5 phpdoc/en/reference/sqlite/functions/sqlite-factory.xml:1.6 --- phpdoc/en/reference/sqlite/functions/sqlite-factory.xml:1.5 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-factory.xml Fri Jan 14 00:42:48 2005 @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="function.sqlite-factory"> <refnamediv> <refname>sqlite_factory</refname> - <refpurpose>Opens a SQLite database and returns an SQLiteDatabase object</refpurpose> + <refpurpose>Opens a SQLite database and returns a SQLiteDatabase object</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -14,13 +14,34 @@ <methodparam choice="opt"><type>string</type><parameter role="reference">error_message</parameter></methodparam> </methodsynopsis> <para> + Returns a SQLiteDatabase object on success, &null; on error. + </para> + <para> <function>sqlite_factory</function> behaves similarly to <function>sqlite_open</function> in that it opens an SQLite database or attempts to create it if it does not exist. However, a <link linkend="sqlite.class.sqlitedatabase">SQLiteDatabase</link> object is - returned rather than a procedural resource. Please see the - <function>sqlite_open</function> reference page for usage and caveats. - </para> + returned rather than a resource. Please see the + <function>sqlite_open</function> reference page for further usage and caveats. + </para> + <para> + <example> + <title><function>sqlite_factory</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_factory('sqlitedb'); +$dbhandle->query('SELECT user_id, username FROM users'); + +/* functionally equivalent to: */ + +$dbhandle = new SQLiteDatabase('sqlitedb'); +$dbhandle->query('SELECT user_id, username FROM users'); + +?>]]> + </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-num-rows.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml:1.6 phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml:1.7 --- phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml:1.6 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml Fri Jan 14 00:42:48 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="function.sqlite-num-rows"> <refnamediv> <refname>sqlite_num_rows</refname> @@ -26,6 +26,28 @@ </para> &sqlite.no-unbuffered; <para> + <example> + <title><function>sqlite_num_rows</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$db = sqlite_open('mysqlitedb'); +$result = sqlite_query($db, "SELECT * FROM mytable WHERE name='John Doe'"); +$rows = sqlite_num_rows($result); + +echo "Number of rows: $rows"; + +/* OO Example */ +$db =& new SQLiteDatabase('mysqlitedb'); +$result = $db->query("SELECT * FROM mytable WHERE name='John Doe'"); +$rows = $result->numRows(); + +echo "Number of rows: $rows"; +?]]> + </programlisting> + </example> + </para> + <para> See also <function>sqlite_changes</function> and <function>sqlite_query</function>. </para> http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-open.xml?r1=1.13&r2=1.14&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-open.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-open.xml:1.13 phpdoc/en/reference/sqlite/functions/sqlite-open.xml:1.14 --- phpdoc/en/reference/sqlite/functions/sqlite-open.xml:1.13 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-open.xml Fri Jan 14 00:42:48 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <refentry id="function.sqlite-open"> <refnamediv> <refname>sqlite_open</refname> @@ -103,6 +103,7 @@ <para> See also <function>sqlite_popen</function>, + <function>sqlite_factory</function>, <function>sqlite_close</function> and <function>sqlite_query</function>. </para>
http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml:1.6 phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml:1.7 --- phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml:1.6 Wed Jan 12 03:56:57 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-busy-timeout.xml Fri Jan 14 00:42:47 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="function.sqlite-busy-timeout"> <refnamediv> <refname>sqlite_busy_timeout</refname> @@ -34,6 +34,24 @@ PHP sets the default busy timeout to be 60 seconds when the database is opened. </para> + <para> + <example> + <title><function>sqlite_busy_timeout</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_open('sqlitedb'); +sqlite_busy_timeout($dbhandle, 10000); // set timeout to 10 seconds +sqlite_busy_timeout($dbhandle, 0); // disable busy handler + +/* OO Example */ +$dbhandle = new SQLiteDatabase('sqlitedb'); +$dbhandle->busyTimeout(10000); // 10 seconds +$dbhandle->busyTimeout(0); // disable +?>]]> + </programlisting> + </example> + </para> <note> <para> There are one thousand (1000) milliseconds in one second. http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-changes.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-changes.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-changes.xml:1.7 phpdoc/en/reference/sqlite/functions/sqlite-changes.xml:1.8 --- phpdoc/en/reference/sqlite/functions/sqlite-changes.xml:1.7 Wed Jan 12 03:56:57 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-changes.xml Fri Jan 14 00:42:47 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry id="function.sqlite-changes"> <refnamediv> <refname>sqlite_changes</refname> @@ -29,6 +29,33 @@ handle. </para> <para> + <example> + <title><function>sqlite_changes</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_open('mysqlitedb'); +$query = sqlite_query($dbhandle, "UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', sqlite_changes($dbhandle); +} + +/* OO Example */ +$dbhandle =& new SQLiteDatabase('mysqlitedb'); +$query = $dbhandle->query("UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', $dbhandle->changes(); +} + +?>]]> + </programlisting> + </example> + </para> + <para> See also <function>sqlite_num_rows</function>. </para> </refsect1> http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-exec.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-exec.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-exec.xml:1.5 phpdoc/en/reference/sqlite/functions/sqlite-exec.xml:1.6 --- phpdoc/en/reference/sqlite/functions/sqlite-exec.xml:1.5 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-exec.xml Fri Jan 14 00:42:47 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="function.sqlite-exec"> <refnamediv> <refname>sqlite_exec</refname> @@ -42,6 +42,33 @@ loaded from a file or have embedded in a script. </simpara> </warning> + <para> + <example> + <title><function>sqlite_exec</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_open('mysqlitedb'); +$query = sqlite_exec($dbhandle, "UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', sqlite_changes($dbhandle); +} + +/* OO Example */ +$dbhandle =& new SQLiteDatabase('mysqlitedb'); +$query = $dbhandle->exec("UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'"); +if (!$query) { + exit('Error in query.'); +} else { + echo 'Number of rows modified: ', $dbhandle->changes(); +} + +?>]]> + </programlisting> + </example> + </para> &sqlite.param-compat; <para> See also <function>sqlite_query</function>, http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-factory.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-factory.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-factory.xml:1.5 phpdoc/en/reference/sqlite/functions/sqlite-factory.xml:1.6 --- phpdoc/en/reference/sqlite/functions/sqlite-factory.xml:1.5 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-factory.xml Fri Jan 14 00:42:48 2005 @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry id="function.sqlite-factory"> <refnamediv> <refname>sqlite_factory</refname> - <refpurpose>Opens a SQLite database and returns an SQLiteDatabase object</refpurpose> + <refpurpose>Opens a SQLite database and returns a SQLiteDatabase object</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -14,13 +14,34 @@ <methodparam choice="opt"><type>string</type><parameter role="reference">error_message</parameter></methodparam> </methodsynopsis> <para> + Returns a SQLiteDatabase object on success, &null; on error. + </para> + <para> <function>sqlite_factory</function> behaves similarly to <function>sqlite_open</function> in that it opens an SQLite database or attempts to create it if it does not exist. However, a <link linkend="sqlite.class.sqlitedatabase">SQLiteDatabase</link> object is - returned rather than a procedural resource. Please see the - <function>sqlite_open</function> reference page for usage and caveats. - </para> + returned rather than a resource. Please see the + <function>sqlite_open</function> reference page for further usage and caveats. + </para> + <para> + <example> + <title><function>sqlite_factory</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$dbhandle = sqlite_factory('sqlitedb'); +$dbhandle->query('SELECT user_id, username FROM users'); + +/* functionally equivalent to: */ + +$dbhandle = new SQLiteDatabase('sqlitedb'); +$dbhandle->query('SELECT user_id, username FROM users'); + +?>]]> + </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-num-rows.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml:1.6 phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml:1.7 --- phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml:1.6 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-num-rows.xml Fri Jan 14 00:42:48 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="function.sqlite-num-rows"> <refnamediv> <refname>sqlite_num_rows</refname> @@ -26,6 +26,28 @@ </para> &sqlite.no-unbuffered; <para> + <example> + <title><function>sqlite_num_rows</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$db = sqlite_open('mysqlitedb'); +$result = sqlite_query($db, "SELECT * FROM mytable WHERE name='John Doe'"); +$rows = sqlite_num_rows($result); + +echo "Number of rows: $rows"; + +/* OO Example */ +$db =& new SQLiteDatabase('mysqlitedb'); +$result = $db->query("SELECT * FROM mytable WHERE name='John Doe'"); +$rows = $result->numRows(); + +echo "Number of rows: $rows"; +?]]> + </programlisting> + </example> + </para> + <para> See also <function>sqlite_changes</function> and <function>sqlite_query</function>. </para> http://cvs.php.net/diff.php/phpdoc/en/reference/sqlite/functions/sqlite-open.xml?r1=1.13&r2=1.14&ty=u Index: phpdoc/en/reference/sqlite/functions/sqlite-open.xml diff -u phpdoc/en/reference/sqlite/functions/sqlite-open.xml:1.13 phpdoc/en/reference/sqlite/functions/sqlite-open.xml:1.14 --- phpdoc/en/reference/sqlite/functions/sqlite-open.xml:1.13 Wed Jan 12 03:56:58 2005 +++ phpdoc/en/reference/sqlite/functions/sqlite-open.xml Fri Jan 14 00:42:48 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <refentry id="function.sqlite-open"> <refnamediv> <refname>sqlite_open</refname> @@ -103,6 +103,7 @@ <para> See also <function>sqlite_popen</function>, + <function>sqlite_factory</function>, <function>sqlite_close</function> and <function>sqlite_query</function>. </para>