mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Unify the database handle name as dbhandle, instead of db or database.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@135559 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
bf474d8709
commit
eb2d8b37a7
12 changed files with 59 additions and 46 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.sqlite-array-query">
|
||||
<refnamediv>
|
||||
<refname>sqlite_array_query</refname>
|
||||
|
@ -9,7 +9,7 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>sqlite_array_query</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<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>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$q = sqlite_query($database, "SELECT * from foo LIMIT 100");
|
||||
$q = sqlite_query($dbhandle, "SELECT * from foo LIMIT 100");
|
||||
$rows = array();
|
||||
while ($r = sqlite_fetch_array($q)) {
|
||||
$rows[] = $r;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry id="function.sqlite-busy-timeout">
|
||||
<refnamediv><refname>sqlite_busy_timeout</refname>
|
||||
<refpurpose>Set busy timeout duration, or disable busy handlers.</refpurpose>
|
||||
|
@ -8,12 +8,12 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>sqlite_busy_timeout</methodname>
|
||||
<methodparam><type>resource</type><parameter>database</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>milliseconds</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Set the maximum time that sqlite will wait for a
|
||||
<parameter>database</parameter>
|
||||
<parameter>dbhandle</parameter>
|
||||
to become ready for use to <parameter>milliseconds</parameter>.
|
||||
If <parameter>milliseconds</parameter> is <literal>0</literal>, busy
|
||||
handlers will be disabled and sqlite will return immediately with a
|
||||
|
@ -29,6 +29,9 @@
|
|||
There are one thousand (1000) milliseconds in one second.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also <function>sqlite_open</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.sqlite-changes">
|
||||
<refnamediv>
|
||||
<refname>sqlite_changes</refname>
|
||||
|
@ -12,11 +12,12 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>sqlite_changes</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the numbers of rows that were changed by the most recent SQL
|
||||
statement executed against the database <parameter>db</parameter>.
|
||||
statement executed against the <parameter>dbhandle</parameter> database
|
||||
handle.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>sqlite_num_rows</function>.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.sqlite-close">
|
||||
<refnamediv>
|
||||
<refname>sqlite_close</refname>
|
||||
|
@ -9,7 +9,7 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>sqlite_close</methodname>
|
||||
<methodparam><type>resource</type><parameter>database</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Closes the given <parameter>database</parameter> handle.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.sqlite-create-aggregate">
|
||||
<refnamediv>
|
||||
<refname>sqlite_create_aggregate</refname>
|
||||
|
@ -9,7 +9,7 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>sqlite_create_aggregate</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>step_func</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>finalize_func</parameter></methodparam>
|
||||
|
@ -49,11 +49,11 @@ $data = array(
|
|||
'nine'
|
||||
'ten'
|
||||
);
|
||||
$db = sqlite_open(':memory:');
|
||||
sqlite_query($db, "CREATE TABLE strings(a)");
|
||||
$dbhandle = sqlite_open(':memory:');
|
||||
sqlite_query($dbhandle, "CREATE TABLE strings(a)");
|
||||
foreach ($data as $str) {
|
||||
$str = sqlite_escape_string($str);
|
||||
sqlite_query($db, "INSERT INTO strings VALUES ('$str')");
|
||||
sqlite_query($dbhandle, "INSERT INTO strings VALUES ('$str')");
|
||||
}
|
||||
|
||||
function max_len_step(&$context, $string) {
|
||||
|
@ -66,9 +66,9 @@ function max_len_finalize(&$context) {
|
|||
return $context;
|
||||
}
|
||||
|
||||
sqlite_create_aggregate($db, 'max_len', 'max_len_step', 'max_len_finalize');
|
||||
sqlite_create_aggregate($dbhandle, 'max_len', 'max_len_step', 'max_len_finalize');
|
||||
|
||||
var_dump(sqlite_array_query($db, 'SELECT max_len(a) from strings'));
|
||||
var_dump(sqlite_array_query($dbhandle, 'SELECT max_len(a) from strings'));
|
||||
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id="function.sqlite-create-function">
|
||||
<refnamediv>
|
||||
<refname>sqlite_create_function</refname>
|
||||
|
@ -11,7 +11,7 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>sqlite_create_function</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>callback</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>num_args</parameter></methodparam>
|
||||
|
@ -23,9 +23,9 @@
|
|||
statements.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>db</parameter> specifies the database handle that you wish to
|
||||
extend, <parameter>function_name</parameter> specifies the name of the
|
||||
function that you will use in your SQL statements,
|
||||
<parameter>dbhandle</parameter> specifies the database handle that you
|
||||
wish to extend, <parameter>function_name</parameter> specifies the name
|
||||
of the function that you will use in your SQL statements,
|
||||
<parameter>callback</parameter> is any valid PHP callback to specify a
|
||||
PHP function that should be called to handle the SQL function.
|
||||
The optional parameter <parameter>num_args</parameter> is used as a hint
|
||||
|
@ -47,9 +47,16 @@ function md5_and_reverse($string) {
|
|||
return strrev(md5($string));
|
||||
}
|
||||
|
||||
sqlite_create_function($db, 'md5rev', 'md5_and_reverse', 1);
|
||||
|
||||
$rows = sqlite_array_query($db, 'SELECT md5rev(filename) from files');
|
||||
if ($dbhandle = sqlite_open('mysqlitedb', 0666, $sqliteerror)) {
|
||||
|
||||
sqlite_create_function($dbhandle, 'md5rev', 'md5_and_reverse', 1);
|
||||
|
||||
$sql = 'SELECT md5rev(filename) FROM files';
|
||||
$rows = sqlite_array_query($dbhandle, $sql);
|
||||
} else {
|
||||
echo 'Error opening sqlite db: ' . $sqliteerror;
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -76,7 +83,7 @@ $rows = sqlite_array_query($db, 'SELECT md5rev(filename) from files');
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$rows = sqlite_array_query($db, "SELECT php('md5', filename) from files");
|
||||
$rows = sqlite_array_query($dbhandle, "SELECT php('md5', filename) from files");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.sqlite-fetch-single">
|
||||
<refnamediv>
|
||||
<refname>sqlite_fetch_single</refname>
|
||||
|
@ -28,15 +28,16 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if ($db = sqlite_open('mysqlitedb', 0666, $sqliteerror)) {
|
||||
if ($dbhandle = sqlite_open('mysqlitedb', 0666, $sqliteerror)) {
|
||||
|
||||
$res = sqlite_query($db, "SELECT id FROM sometable WHERE id = 42");
|
||||
$sql = "SELECT id FROM sometable WHERE id = 42";
|
||||
$res = sqlite_query($dbhandle, $sql);
|
||||
|
||||
if (sqlite_num_rows($res) > 0) {
|
||||
echo sqlite_fetch_single($res); // 42
|
||||
}
|
||||
|
||||
sqlite_close($db);
|
||||
sqlite_close($dbhandle);
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.sqlite-last-error">
|
||||
<refnamediv>
|
||||
<refname>sqlite_last_error</refname>
|
||||
|
@ -9,11 +9,11 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>sqlite_last_error</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the error code from the last operation performed on
|
||||
<parameter>db</parameter>, the database handle. A human readable
|
||||
<parameter>dbhandle</parameter>, the database handle. A human readable
|
||||
description of the error code can be retrieved using
|
||||
<function>sqlite_error_string</function>.
|
||||
</para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.sqlite-last-insert-rowid">
|
||||
<refnamediv>
|
||||
<refname>sqlite_last_insert_rowid</refname>
|
||||
|
@ -9,11 +9,11 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>sqlite_last_insert_rowid</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the rowid of the row that was most recently inserted into the
|
||||
database <parameter>db</parameter>, if it was created as an
|
||||
database <parameter>dbhandle</parameter>, if it was created as an
|
||||
auto-increment field.
|
||||
</para>
|
||||
<tip>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry id="function.sqlite-open">
|
||||
<refnamediv>
|
||||
<refname>sqlite_open</refname>
|
||||
|
@ -14,7 +14,7 @@
|
|||
<methodparam choice="opt"><type>string</type><parameter>&error_message</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns a resource on success, &false; on error.
|
||||
Returns a resource (database handle) on success, &false; on error.
|
||||
</para>
|
||||
<para>
|
||||
The <parameter>filename</parameter> parameter is the name of the
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.sqlite-query">
|
||||
<refnamediv>
|
||||
<refname>sqlite_query</refname>
|
||||
|
@ -11,17 +11,18 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>sqlite_query</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>sqlite_query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Executes an SQL statement given by the <parameter>query</parameter> against
|
||||
a given database (specified by the <parameter>db</parameter> parameter).
|
||||
a given database handle (specified by the <parameter>dbhandle</parameter>
|
||||
parameter).
|
||||
</para>
|
||||
<para>
|
||||
For queries that return rows, this function will return a result handle
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id="function.sqlite-unbuffered-query">
|
||||
<refnamediv>
|
||||
<refname>sqlite_unbuffered_query</refname>
|
||||
|
@ -9,13 +9,13 @@
|
|||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>sqlite_unbuffered_query</methodname>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>sqlite_unbuffered_query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>db</parameter></methodparam>
|
||||
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>sqlite_unbuffered_query</function> is identical to
|
||||
|
|
Loading…
Reference in a new issue