mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Add/Update examples (incorp. user notes)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@177193 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
fe15930526
commit
43b3558404
6 changed files with 126 additions and 10 deletions
|
@ -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.
|
||||
|
|
|
@ -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>
|
||||
|
@ -28,6 +28,33 @@
|
|||
statement executed against the <parameter>dbhandle</parameter> database
|
||||
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>
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>
|
||||
|
@ -13,14 +13,35 @@
|
|||
<methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam>
|
||||
<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>.
|
||||
|
|
|
@ -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>
|
||||
|
@ -25,6 +25,28 @@
|
|||
set.
|
||||
</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>.
|
||||
|
|
|
@ -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 @@ if ($db = sqlite_open('mysqlitedb', 0666, $sqliteerror)) {
|
|||
|
||||
<para>
|
||||
See also <function>sqlite_popen</function>,
|
||||
<function>sqlite_factory</function>,
|
||||
<function>sqlite_close</function> and
|
||||
<function>sqlite_query</function>.
|
||||
</para>
|
||||
|
|
Loading…
Reference in a new issue