Convert several more pgsql extension doc pages to the new format.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@189783 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christopher Kings-Lynne 2005-07-03 10:03:51 +00:00
parent ca8e71d84b
commit 8807d406a7
8 changed files with 437 additions and 55 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.14 $ -->
<!-- $Revision: 1.15 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-delete'>
<refnamediv>
@ -19,17 +19,66 @@
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_delete</function> deletes record condition specified by
<parameter>assoc_array</parameter> which has
<literal>field=>value</literal>. If <parameter>options</parameter> is
<function>pg_delete</function> deletes records from a table specified by
the keys and values in <parameter>assoc_array</parameter>. If <parameter>options</parameter> is
specified, <function>pg_convert</function> is applied
to <parameter>assoc_array</parameter> with specified option.
&return.success;
If <constant>PGSQL_DML_STRING</constant> is part of the
<parameter>options</parameter> then query string is returned.
to <parameter>assoc_array</parameter> with the specified options.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
PostgreSQL database connection resource.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>table_name</parameter></term>
<listitem>
<para>
Name of the table from which to delete rows.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>assoc_array</parameter></term>
<listitem>
<para>
An <type>array</type> whose keys are field names in the table <parameter>table_name</parameter>,
and whose values are the values of those fields that are to be deleted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Any number of <constant>PGSQL_CONV_FORCE_NULL</constant>,
<constant>PGSQL_DML_NO_CONV</constant>,
<constant>PGSQL_DML_EXEC</constant> or
<constant>PGSQL_DML_STRING</constant> combined. If <constant>PGSQL_DML_STRING</constant> is part of the
<parameter>options</parameter> then query string is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success; Returns <type>string</type> if <constant>PGSQL_DML_STRING</constant> is passed
via <parameter>options</parameter>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
<refentry id='function.pg-escape-bytea'>
<refnamediv>
<refname>pg_escape_bytea</refname>
<refpurpose>
Escape binary for bytea type
Escape a string for insertion into a bytea field
</refpurpose>
</refnamediv>
@ -21,22 +21,72 @@
</para>
<note>
<para>
When you SELECT bytea type, PostgreSQL returns octal byte value
prefixed by \ (e.g. \032). Users are supposed to convert back to
binary format by yourself.
When you <literal>SELECT</select> a bytea type, PostgreSQL returns octal byte values
prefixed with '\' (e.g. \032). Users are supposed to convert back to
binary format manually.
</para>
<para>
This function requires PostgreSQL 7.2 or later. With PostgreSQL
7.2.0 and 7.2.1, bytea type must be casted when you enable
7.2.0 and 7.2.1, bytea values must be cast when you enable
multi-byte support. i.e. <literal>INSERT INTO test_table (image)
VALUES ('$image_escaped'::bytea);</literal> PostgreSQL 7.2.2 or
later does not need cast. Exception is when client and backend
character encoding does not match, there may be multi-byte
stream error. User must cast to bytea to avoid this error.
later does not need a cast. The exception is when the client and backend
character encoding does not match, and there may be multi-byte
stream error. User must then cast to bytea to avoid this error.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
A <type>string</type> containing text or binary data to be inserted into a bytea
column.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A <type>string</type> containing the escaped data.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_escape_bytea</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Connect to the database
$dbconn = pg_connect('dbname=foo');
// Read in a binary file
$data = file_get_contents('image1.jpg');
// Escape the binary data
$escaped = pg_escape_bytea($data);
// Insert it into the database
pg_query("INSERT INTO gallery (name, data) VALUES ('Pine trees', '{$escaped}')";
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
<refentry id='function.pg-escape-string'>
<refnamediv>
<refname>pg_escape_string</refname>
<refpurpose>
Escape string for text/char type
Escape a string for insertion into a text field
</refpurpose>
</refnamediv>
@ -16,10 +16,12 @@
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_escape_string</function> escapes string for
text/char datatype. It returns escaped string for
PostgreSQL. Use of this function is recommended instead of
<function>addslashes</function>.
<function>pg_escape_string</function> escapes a string for
insertion into the database. It returns an escaped string in the
PostgreSQL format. Use of this function is recommended instead of
<function>addslashes</function>. If the type of the column
is bytea, <function>pg_escape_bytea</function> must be used
instead.
</para>
<note>
<para>
@ -28,6 +30,55 @@
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
A <type>string</type> containing text to be escaped.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A <type>string</type> containing the escaped data.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_escape_string</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Connect to the database
$dbconn = pg_connect('dbname=foo');
// Read in a text file (containing apostrophes and backslashes)
$data = file_get_contents('letter.txt');
// Escape the text data
$escaped = pg_escape_string($data);
// Insert it into the database
pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', '{$escaped}')";
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-free-result">
<refnamediv>
@ -14,14 +14,13 @@
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_free_result</function> only needs to be called if you
are worried about using too much memory while your script is
running. All result memory will automatically be freed when the
script is finished. But, if you are sure you are not going to
need the result data anymore in a script, you may call
<function>pg_free_result</function> with the
<parameter>result</parameter> resource as an argument and the
associated result memory will be freed. &return.success;
<function>pg_free_result</function> frees the memory and data associated with the
specified PostgreSQL query result <type>resource</type>.
</para>
<para>
This function need only be called if memory
consumption during script execution is a problem. Otherwise, all result memory will
be automatically freed when the script ends.
</para>
<note>
<para>
@ -30,11 +29,68 @@
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
<para>
PostgreSQL query result resource, returned by <function>pg_query</function>,
<function>pg_query_params</function> or <function>pg_execute</function>
(among others).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_free_result</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$db = pg_connect("dbname=users user=me") || die();
$res = pg_query($db, "SELECT 1 UNION ALL SELECT 2");
$val = pg_fetch_result($res, 1, 0);
echo "First field in the second row is: ", $val, "\n";
pg_free_result($res);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
First field in the second row is: 2
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_query</function></member>
<member><function>pg_query_params</function></member>
<member><function>pg_execute</function></member>
</simplelist>
</para>
</refsect1>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<refentry id="function.pg-get-notify">
<refnamediv>
<refname>pg_get_notify</refname>
@ -14,15 +14,54 @@
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_get_notify</function> gets notify message sent by
<literal>NOTIFY</literal> SQL command. To receive notify
messages, <literal>LISTEN</literal> SQL command must be
issued. If there is notify message on the connection, array
contains message name and backend PID is returned. If there is no
message, &false; is returned.
<function>pg_get_notify</function> gets notifications generated by a
<literal>NOTIFY</literal> SQL command. To receive notifications,
the <literal>LISTEN</literal> SQL command must be
issued.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
PostgreSQL database connection resource.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>result_type</parameter></term>
<listitem>
<para>
An optional parameter that controls
how the returned <type>array</type> is indexed.
<parameter>result_type</parameter> is a constant and can take the
following values: <constant>PGSQL_ASSOC</constant>,
<constant>PGSQL_NUM</constant> and <constant>PGSQL_BOTH</constant>.
Using <constant>PGSQL_NUM</constant>, <function>pg_get_notify</function>
will return an array with numerical indices, using
<constant>PGSQL_ASSOC</constant> it will return only associative indices
while <constant>PGSQL_BOTH</constant>, the default, will return both
numerical and associative indices.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
An <type>array</type> containing the <literal>NOTIFY</literal> message name and backend PID.
Otherwise if no </literal>NOTIFY</literal> is waiting, then &false; is returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.pg-get-pid">
<refnamediv>
<refname>pg_get_pid</refname>
<refpurpose>Gets backend's process ID</refpurpose>
<refpurpose>Gets the backend's process ID</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -13,12 +13,36 @@
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_get_pid</function> gets backend (database server
process) PID. PID is useful to check if <literal>NOTIFY</literal>
message is sent from other process or not.
<function>pg_get_pid</function> gets the backend's (database server
process) PID. The PID is useful to determine whether or not a <literal>NOTIFY</literal>
message received via <function>pg_get_notify</function> is sent from another process
or not.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
PostgreSQL database connection resource.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The backend database process ID.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.15 $ -->
<!-- $Revision: 1.16 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-insert'>
<refnamediv>
@ -21,18 +21,68 @@
<para>
<function>pg_insert</function> inserts the values of <parameter>assoc_array</parameter>
into the table specified by <parameter>table_name</parameter>.
<parameter>table_name</parameter> must at least have as many columns as
<parameter>assoc_array</parameter> has elements. The fieldnames in
<parameter>table_name</parameter> must match the indices of <parameter>assoc_array</parameter>.
&return.success;
If <parameter>options</parameter> is specified, <function>pg_insert</function>
is applied to <parameter>assoc_array</parameter> with specified option.
If <constant>PGSQL_DML_STRING</constant> is part of the
<parameter>options</parameter> then query string is returned.
If <parameter>options</parameter> is
specified, <function>pg_convert</function> is applied
to <parameter>assoc_array</parameter> with the specified options.
</para>
&warn.experimental.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
PostgreSQL database connection resource.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>table_name</parameter></term>
<listitem>
<para>
Name of the table into which to insert rows. The table <parameter>table_name</parameter> must at least
have as many columns as <parameter>assoc_array</parameter> has elements.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>assoc_array</parameter></term>
<listitem>
<para>
An <type>array</type> whose keys are field names in the table <parameter>table_name</parameter>,
and whose values are the values of those fields that are to be inserted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Any number of <constant>PGSQL_CONV_OPTS</constant>,
<constant>PGSQL_DML_NO_CONV</constant>,
<constant>PGSQL_DML_EXEC</constant>,
<constant>PGSQL_DML_ASYNC</constant> or
<constant>PGSQL_DML_STRING</constant> combined. If <constant>PGSQL_DML_STRING</constant> is part of the
<parameter>options</parameter> then query string is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success; Returns <type>string</type> if <constant>PGSQL_DML_STRING</constant> is passed
via <parameter>options</parameter>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<!-- $Revision: 1.14 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-update'>
<refnamediv>
@ -29,6 +29,69 @@
&warn.experimental.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
PostgreSQL database connection resource.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>table_name</parameter></term>
<listitem>
<para>
Name of the table into which to insert rows. The table <parameter>table_name</parameter> must at least
have as many columns as <parameter>condition</parameter> has elements.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
An <type>array</type> whose keys are field names in the table <parameter>table_name</parameter>,
and whose values are what matched rows are to be updated to.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>condition</parameter></term>
<listitem>
<para>
An <type>array</type> whose keys are field names in the table <parameter>table_name</parameter>,
and whose values are the conditions that a row must meet to be updated.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Any number of <constant>PGSQL_CONV_OPTS</constant>,
<constant>PGSQL_DML_NO_CONV</constant>,
<constant>PGSQL_DML_EXEC</constant> or
<constant>PGSQL_DML_STRING</constant> combined. If <constant>PGSQL_DML_STRING</constant> is part of the
<parameter>options</parameter> then query string is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success; Returns <type>string</type> if <constant>PGSQL_DML_STRING</constant> is passed
via <parameter>options</parameter>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>