WS fix (start at col 0)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@181618 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kenneth Schwartz 2005-03-08 00:06:33 +00:00
parent 1a7f4ff83a
commit df20a9c5c9
70 changed files with 3023 additions and 3022 deletions

View file

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-affected-rows">
<refnamediv>
<refname>pg_affected_rows</refname>
<refpurpose>Returns number of affected records (tuples)</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_affected_rows</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_affected_rows</function> returns the number of tuples
(instances/records/rows) affected by INSERT, UPDATE, and DELETE
queries executed by <function>pg_query</function>. If no tuple is
affected by this function, it will return 0.
</para>
<para>
<example>
<title><function>pg_affected_rows</function> example</title>
<programlisting role="php">
<refentry id="function.pg-affected-rows">
<refnamediv>
<refname>pg_affected_rows</refname>
<refpurpose>Returns number of affected records (tuples)</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_affected_rows</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_affected_rows</function> returns the number of tuples
(instances/records/rows) affected by INSERT, UPDATE, and DELETE
queries executed by <function>pg_query</function>. If no tuple is
affected by this function, it will return 0.
</para>
<para>
<example>
<title><function>pg_affected_rows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = pg_query($conn, "INSERT INTO authors VALUES ('Orwell', 2002, 'Animal Farm')");
$cmdtuples = pg_affected_rows($result);
echo $cmdtuples . " tuples are affected.\n";
$result = pg_query($conn, "INSERT INTO authors VALUES ('Orwell', 2002, 'Animal Farm')");
$cmdtuples = pg_affected_rows($result);
echo $cmdtuples . " tuples are affected.\n";
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
This function used to be called <literal>pg_cmdtuples()</literal>.
</para>
</note>
<para>
See also <function>pg_query</function> and
<function>pg_num_rows</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
This function used to be called <literal>pg_cmdtuples()</literal>.
</para>
</note>
<para>
See also <function>pg_query</function> and
<function>pg_num_rows</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,30 +1,30 @@
<?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-cancel-query'>
<refnamediv>
<refname>pg_cancel_query</refname>
<refpurpose>
Cancel asynchronous query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_cancel_query</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_cancel_query</function> cancel asynchronous query sent by
<function>pg_send_query</function>. You cannot cancel query executed by
<function>pg_query</function>.
</para>
<para>
See also <function>pg_send_query</function> and
<function>pg_connection_busy</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-cancel-query'>
<refnamediv>
<refname>pg_cancel_query</refname>
<refpurpose>
Cancel asynchronous query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_cancel_query</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_cancel_query</function> cancel asynchronous query sent by
<function>pg_send_query</function>. You cannot cancel query executed by
<function>pg_query</function>.
</para>
<para>
See also <function>pg_send_query</function> and
<function>pg_connection_busy</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.16 -->
<refentry id="function.pg-client-encoding">
<refnamediv>
<refname>pg_client_encoding</refname>
<refpurpose>
Gets the client encoding
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_client_encoding</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_client_encoding</function> returns the client
encoding as the string. The returned string should be either :
SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE,
MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT, SJIS, BIG5,
WIN1250.
</para>
<note>
<para>
This function requires PHP-4.0.3 or higher and PostgreSQL-7.0 or
higher. If libpq is compiled without multibyte encoding support,
<function>pg_set_client_encoding</function> always return
&quot;SQL_ASCII&quot;. Supported encoding depends on PostgreSQL
version. Refer to PostgreSQL manual for details to enable
multibyte support and encoding supported.
</para>
<para>
The function used to be called <function>pg_clientencoding</function>.
</para>
</note>
<para>
See also <function>pg_set_client_encoding</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-client-encoding">
<refnamediv>
<refname>pg_client_encoding</refname>
<refpurpose>
Gets the client encoding
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_client_encoding</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_client_encoding</function> returns the client
encoding as the string. The returned string should be either :
SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE,
MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT, SJIS, BIG5,
WIN1250.
</para>
<note>
<para>
This function requires PHP-4.0.3 or higher and PostgreSQL-7.0 or
higher. If libpq is compiled without multibyte encoding support,
<function>pg_set_client_encoding</function> always return
&quot;SQL_ASCII&quot;. Supported encoding depends on PostgreSQL
version. Refer to PostgreSQL manual for details to enable
multibyte support and encoding supported.
</para>
<para>
The function used to be called <function>pg_clientencoding</function>.
</para>
</note>
<para>
See also <function>pg_set_client_encoding</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,50 +1,50 @@
<?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.82 -->
<refentry id="function.pg-close">
<refnamediv>
<refname>pg_close</refname>
<refpurpose>Closes a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_close</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_close</function> closes the non-persistent
connection to a PostgreSQL database associated with the given
<parameter>connection</parameter> resource. &return.success;
</para>
<note>
<para>
Using <function>pg_close</function> is not usually necessary, as
non-persistent open connections are automatically closed at the end
of the script.
</para>
</note>
<para>
<example>
<title><function>pg_close</function> example</title>
<programlisting role="php">
<refentry id="function.pg-close">
<refnamediv>
<refname>pg_close</refname>
<refpurpose>Closes a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_close</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_close</function> closes the non-persistent
connection to a PostgreSQL database associated with the given
<parameter>connection</parameter> resource. &return.success;
</para>
<note>
<para>
Using <function>pg_close</function> is not usually necessary, as
non-persistent open connections are automatically closed at the end
of the script.
</para>
</note>
<para>
<example>
<title><function>pg_close</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
echo "Connected successfully";
pg_close($dbconn);
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
echo "Connected successfully";
pg_close($dbconn);
?>
]]>
</programlisting>
</example>
</para>
<para>
If there is open large object resource on the connection, do not
close the connection before closing all large object resources.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
If there is open large object resource on the connection, do not
close the connection before closing all large object resources.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,32 +1,32 @@
<?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.2 -->
<refentry id="function.pg-connect">
<refnamediv>
<refname>pg_connect</refname>
<refpurpose>Open a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_connect</methodname>
<methodparam><type>string</type><parameter>connection_string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>connect_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connect</function> returns a connection resource
that is needed by other PostgreSQL functions.
</para>
<para>
<function>pg_connect</function> opens a connection to a
PostgreSQL database specified by the
<parameter>connection_string</parameter>. It returns a connection
resource on success. It returns &false; if the connection could
not be made. <parameter>connection_string</parameter> should be
a quoted string.
<example>
<title>Using <function>pg_connect</function></title>
<programlisting role="php">
<refentry id="function.pg-connect">
<refnamediv>
<refname>pg_connect</refname>
<refpurpose>Open a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_connect</methodname>
<methodparam><type>string</type><parameter>connection_string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>connect_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connect</function> returns a connection resource
that is needed by other PostgreSQL functions.
</para>
<para>
<function>pg_connect</function> opens a connection to a
PostgreSQL database specified by the
<parameter>connection_string</parameter>. It returns a connection
resource on success. It returns &false; if the connection could
not be made. <parameter>connection_string</parameter> should be
a quoted string.
<example>
<title>Using <function>pg_connect</function></title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=mary");
@ -43,38 +43,38 @@ $dbconn4 = pg_connect($conn_string);
//connect to a database named "test" on the host "sheep" with a username and password
?>
]]>
</programlisting>
</example>
The arguments available for
<parameter>connection_string</parameter> includes
<parameter>host</parameter>, <parameter>port</parameter>,
<parameter>tty</parameter>, <parameter>options</parameter>,
<parameter>dbname</parameter>, <parameter>user</parameter>, and
<parameter>password</parameter>.
</para>
<para>
If a second call is made to <function>pg_connect</function> with
the same <parameter>connection_string</parameter>, no
new connection will be established unless you pass
<constant>PGSQL_CONNECT_FORCE_NEW</constant> as
<parameter>connect_type</parameter>, but instead, the connection
resource of the already opened connection will be returned. You
can have multiple connections to the same database if you use
different connection strings.
</para>
<para>
The old syntax with multiple parameters
<command>$conn = pg_connect("host", "port", "options", "tty", "dbname")
</command> has been deprecated.
</para>
<para>
See also <function>pg_pconnect</function>,
<function>pg_close</function>, <function>pg_host</function>,
<function>pg_port</function>, <function>pg_tty</function>,
<function>pg_options</function> and <function>pg_dbname</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
The arguments available for
<parameter>connection_string</parameter> includes
<parameter>host</parameter>, <parameter>port</parameter>,
<parameter>tty</parameter>, <parameter>options</parameter>,
<parameter>dbname</parameter>, <parameter>user</parameter>, and
<parameter>password</parameter>.
</para>
<para>
If a second call is made to <function>pg_connect</function> with
the same <parameter>connection_string</parameter>, no
new connection will be established unless you pass
<constant>PGSQL_CONNECT_FORCE_NEW</constant> as
<parameter>connect_type</parameter>, but instead, the connection
resource of the already opened connection will be returned. You
can have multiple connections to the same database if you use
different connection strings.
</para>
<para>
The old syntax with multiple parameters
<command>$conn = pg_connect("host", "port", "options", "tty", "dbname")
</command> has been deprecated.
</para>
<para>
See also <function>pg_pconnect</function>,
<function>pg_close</function>, <function>pg_host</function>,
<function>pg_port</function>, <function>pg_tty</function>,
<function>pg_options</function> and <function>pg_dbname</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id='function.pg-connection-busy'>
<refnamediv>
<refname>pg_connection_busy</refname>
<refpurpose>
Get connection is busy or not
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_connection_busy</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connection_busy</function> returns &true; if the
connection is busy. If it is busy, a previous query is still executing.
If <function>pg_get_result</function> is called, it will be blocked.
</para>
<para>
<example>
<title><function>pg_connection_busy</function> example</title>
<programlisting role="php">
<refentry id='function.pg-connection-busy'>
<refnamediv>
<refname>pg_connection_busy</refname>
<refpurpose>
Get connection is busy or not
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_connection_busy</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connection_busy</function> returns &true; if the
connection is busy. If it is busy, a previous query is still executing.
If <function>pg_get_result</function> is called, it will be blocked.
</para>
<para>
<example>
<title><function>pg_connection_busy</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$bs = pg_connection_busy($dbconn);
if ($bs) {
echo 'connection is busy';
} else {
echo 'connection is not busy';
}
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$bs = pg_connection_busy($dbconn);
if ($bs) {
echo 'connection is busy';
} else {
echo 'connection is not busy';
}
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connection_status</function> and
<function>pg_get_result</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connection_status</function> and
<function>pg_get_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,48 +1,48 @@
<?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.82 -->
<refentry id='function.pg-connection-reset'>
<refnamediv>
<refname>pg_connection_reset</refname>
<refpurpose>
Reset connection (reconnect)
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_connection_reset</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connection_reset</function> resets the connection.
It is useful for error recovery. &return.success;
</para>
<para>
<example>
<title><function>pg_connection_reset</function> example</title>
<programlisting role="php">
<refentry id='function.pg-connection-reset'>
<refnamediv>
<refname>pg_connection_reset</refname>
<refpurpose>
Reset connection (reconnect)
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_connection_reset</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connection_reset</function> resets the connection.
It is useful for error recovery. &return.success;
</para>
<para>
<example>
<title><function>pg_connection_reset</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$dbconn2 = pg_connection_reset($dbconn);
if ($dbconn2) {
echo "reset successful\n";
} else {
echo "reset failed\n";
}
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$dbconn2 = pg_connection_reset($dbconn);
if ($dbconn2) {
echo "reset successful\n";
} else {
echo "reset failed\n";
}
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connect</function>,
<function>pg_pconnect</function> and
<function>pg_connection_status</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connect</function>,
<function>pg_pconnect</function> and
<function>pg_connection_status</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id='function.pg-connection-status'>
<refnamediv>
<refname>pg_connection_status</refname>
<refpurpose>
Get connection status
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_connection_status</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connection_status</function> returns a connection status.
Possible statuses are <literal>PGSQL_CONNECTION_OK</literal> and
<literal>PGSQL_CONNECTION_BAD</literal>. The return value 0 as
integer indicates a valid connection.
</para>
<para>
<example>
<title><function>pg_connection_status</function> example</title>
<programlisting role="php">
<refentry id='function.pg-connection-status'>
<refnamediv>
<refname>pg_connection_status</refname>
<refpurpose>
Get connection status
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_connection_status</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connection_status</function> returns a connection status.
Possible statuses are <literal>PGSQL_CONNECTION_OK</literal> and
<literal>PGSQL_CONNECTION_BAD</literal>. The return value 0 as
integer indicates a valid connection.
</para>
<para>
<example>
<title><function>pg_connection_status</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$stat = pg_connection_status($dbconn);
if ($stat === 0) {
echo 'Connection status ok';
} else {
echo 'Connection status bad';
}
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$stat = pg_connection_status($dbconn);
if ($stat === 0) {
echo 'Connection status ok';
} else {
echo 'Connection status bad';
}
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connection_busy</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connection_busy</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,38 +1,38 @@
<?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.80 -->
<refentry id='function.pg-convert'>
<refnamediv>
<refname>pg_convert</refname>
<refpurpose>
Convert associative array value into suitable for SQL statement
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_convert</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_convert</function> checks and converts the values in
<literal>assoc_array</literal> into suitable values for use in a SQL
statement. Precondition for <function>pg_convert</function> is the existence
of a table <literal>table_name</literal> which has at least as many columns
as <literal>assoc_array</literal> has elements. The fieldnames as well as
the fieldvalues in <literal>table_name</literal> must match the indices and
values of <literal>assoc_array</literal>. Returns an array with the converted
values on success, &false; otherwise.
</para>
&warn.experimental.func;
<para>
See also <function>pg_meta_data</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-convert'>
<refnamediv>
<refname>pg_convert</refname>
<refpurpose>
Convert associative array value into suitable for SQL statement
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_convert</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_convert</function> checks and converts the values in
<literal>assoc_array</literal> into suitable values for use in a SQL
statement. Precondition for <function>pg_convert</function> is the existence
of a table <literal>table_name</literal> which has at least as many columns
as <literal>assoc_array</literal> has elements. The fieldnames as well as
the fieldvalues in <literal>table_name</literal> must match the indices and
values of <literal>assoc_array</literal>. Returns an array with the converted
values on success, &false; otherwise.
</para>
&warn.experimental.func;
<para>
See also <function>pg_meta_data</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,34 +1,34 @@
<?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.82 -->
<refentry id='function.pg-copy-from'>
<refnamediv>
<refname>pg_copy_from</refname>
<refpurpose>
Insert records into a table from an array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_copy_from</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>rows</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>delimiter</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>null_as</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_copy_from</function> insert records into a table from
<parameter>rows</parameter>. It issues <literal>COPY FROM</literal> SQL command
internally to insert records.
&return.success;
</para>
<para>
See also <function>pg_copy_to</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-copy-from'>
<refnamediv>
<refname>pg_copy_from</refname>
<refpurpose>
Insert records into a table from an array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_copy_from</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>rows</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>delimiter</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>null_as</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_copy_from</function> insert records into a table from
<parameter>rows</parameter>. It issues <literal>COPY FROM</literal> SQL command
internally to insert records.
&return.success;
</para>
<para>
See also <function>pg_copy_to</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,33 +1,33 @@
<?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.2 -->
<refentry id='function.pg-copy-to'>
<refnamediv>
<refname>pg_copy_to</refname>
<refpurpose>
Copy a table to an array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_copy_to</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>delimiter</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>null_as</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_copy_to</function> copies a table to an array. It
issues <literal>COPY TO</literal> SQL command internally to
retrieve records. The resulting array is returned. It returns
&false; on failure.
</para>
<para>
See also <function>pg_copy_from</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-copy-to'>
<refnamediv>
<refname>pg_copy_to</refname>
<refpurpose>
Copy a table to an array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_copy_to</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>delimiter</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>null_as</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_copy_to</function> copies a table to an array. It
issues <literal>COPY TO</literal> SQL command internally to
retrieve records. The resulting array is returned. It returns
&false; on failure.
</para>
<para>
See also <function>pg_copy_from</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-dbname">
<refnamediv>
<refname>pg_dbname</refname>
<refpurpose>Get the database name</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_dbname</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_dbname</function> returns the name of the database
that the given PostgreSQL <parameter>connection</parameter>
resource. It returns &false;, if <parameter>connection</parameter>
is not a valid PostgreSQL connection resource.
</para>
<para>
<example>
<title><function>pg_dbname</function> example</title>
<programlisting role="php">
<refentry id="function.pg-dbname">
<refnamediv>
<refname>pg_dbname</refname>
<refpurpose>Get the database name</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_dbname</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_dbname</function> returns the name of the database
that the given PostgreSQL <parameter>connection</parameter>
resource. It returns &false;, if <parameter>connection</parameter>
is not a valid PostgreSQL connection resource.
</para>
<para>
<example>
<title><function>pg_dbname</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
error_reporting(E_ALL);
error_reporting(E_ALL);
pg_connect("host=localhost port=5432 dbname=mary");
echo pg_dbname(); // mary
pg_connect("host=localhost port=5432 dbname=mary");
echo pg_dbname(); // mary
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,54 +1,54 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-delete'>
<refnamediv>
<refname>pg_delete</refname>
<refpurpose>
Deletes records
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>pg_delete</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_delete</function> deletes record condition specified by
<literal>assoc_array</literal> which has
<literal>field=>value</literal>. If <literal>option</literal> is
specified, <function>pg_convert</function> is applied
to <literal>assoc_array</literal> with specified option.
</para>
<para>
<example>
<title><function>pg_delete</function> example</title>
<programlisting role="php">
<refentry id='function.pg-delete'>
<refnamediv>
<refname>pg_delete</refname>
<refpurpose>
Deletes records
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>pg_delete</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_delete</function> deletes record condition specified by
<literal>assoc_array</literal> which has
<literal>field=>value</literal>. If <literal>option</literal> is
specified, <function>pg_convert</function> is applied
to <literal>assoc_array</literal> with specified option.
</para>
<para>
<example>
<title><function>pg_delete</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$db = pg_connect('dbname=foo');
// This is safe, since $_POST is converted automatically
$res = pg_delete($db, 'post_log', $_POST);
if ($res) {
echo "POST data is deleted: $res\n";
} else {
echo "User must have sent wrong inputs\n";
}
$db = pg_connect('dbname=foo');
// This is safe, since $_POST is converted automatically
$res = pg_delete($db, 'post_log', $_POST);
if ($res) {
echo "POST data is deleted: $res\n";
} else {
echo "User must have sent wrong inputs\n";
}
?>
]]>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id="function.pg-end-copy">
<refnamediv>
<refname>pg_end_copy</refname>
<refpurpose>Sync with PostgreSQL backend</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_end_copy</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_end_copy</function> syncs the PostgreSQL frontend
(usually a web server process) with the PostgreSQL server after
doing a copy operation performed by
<function>pg_put_line</function>. <function>pg_end_copy</function>
must be issued, otherwise the PostgreSQL server may get out of
sync with the frontend and will report an error. &return.success;
</para>
<para>
For further details and an example, see also
<function>pg_put_line</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-end-copy">
<refnamediv>
<refname>pg_end_copy</refname>
<refpurpose>Sync with PostgreSQL backend</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_end_copy</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_end_copy</function> syncs the PostgreSQL frontend
(usually a web server process) with the PostgreSQL server after
doing a copy operation performed by
<function>pg_put_line</function>. <function>pg_end_copy</function>
must be issued, otherwise the PostgreSQL server may get out of
sync with the frontend and will report an error. &return.success;
</para>
<para>
For further details and an example, see also
<function>pg_put_line</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,45 +1,45 @@
<?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-bytea'>
<refnamediv>
<refname>pg_escape_bytea</refname>
<refpurpose>
Escape binary for bytea type
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_escape_bytea</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_escape_bytea</function> escapes string for
bytea datatype. It returns escaped string.
</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.
</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
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.
</para>
</note>
<para>
See also <function>pg_unescape_bytea</function> and
<function>pg_escape_string</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-escape-bytea'>
<refnamediv>
<refname>pg_escape_bytea</refname>
<refpurpose>
Escape binary for bytea type
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_escape_bytea</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_escape_bytea</function> escapes string for
bytea datatype. It returns escaped string.
</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.
</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
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.
</para>
</note>
<para>
See also <function>pg_unescape_bytea</function> and
<function>pg_escape_string</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- 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
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_escape_string</methodname>
<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>.
<refentry id='function.pg-escape-string'>
<refnamediv>
<refname>pg_escape_string</refname>
<refpurpose>
Escape string for text/char type
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_escape_string</methodname>
<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>.
</para>
<note>
<para>
This function requires PostgreSQL 7.2 or later.
</para>
<note>
<para>
This function requires PostgreSQL 7.2 or later.
</para>
</note>
<para>
See also <function>pg_escape_bytea</function>
</para>
</refsect1>
</refentry>
</note>
<para>
See also <function>pg_escape_bytea</function>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,39 +1,39 @@
<?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.2 -->
<refentry id="function.pg-fetch-all">
<refnamediv>
<refname>pg_fetch_all</refname>
<refpurpose>Fetches all rows from a result as an array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_all</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_all</function> returns an array that
contains all rows (tuples/records) in result resource. It returns
&false;, if there are no rows.
</para>
&database.fetch-null;
<para>
<example>
<title>PostgreSQL fetch all</title>
<programlisting role="php">
<refentry id="function.pg-fetch-all">
<refnamediv>
<refname>pg_fetch_all</refname>
<refpurpose>Fetches all rows from a result as an array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_all</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_all</function> returns an array that
contains all rows (tuples/records) in result resource. It returns
&false;, if there are no rows.
</para>
&database.fetch-null;
<para>
<example>
<title>PostgreSQL fetch all</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
$result = pg_query($conn, "SELECT * FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
$arr = pg_fetch_all($result);
@ -42,17 +42,17 @@ var_dump($arr);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>pg_fetch_row</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>pg_fetch_row</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,75 +1,75 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-fetch-array">
<refnamediv>
<refname>pg_fetch_array</refname>
<refpurpose>Fetch a row as an array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_array</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
</methodsynopsis>
<refentry id="function.pg-fetch-array">
<refnamediv>
<refname>pg_fetch_array</refname>
<refpurpose>Fetch a row as an array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_array</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_array</function> returns an array that
corresponds to the fetched row (tuples/records). It returns
&false;, if there are no more rows.
</para>
<para>
<function>pg_fetch_array</function> is an extended version of
<function>pg_fetch_row</function>. In addition to storing the
data in the numeric indices (field index) to the result array, it
also stores the data in associative indices (field name) by
default.
</para>
&database.fetch-null;
<para>
<parameter>row</parameter> is row (record) number to be
retrieved. First row is 0.
</para>
<para>
<parameter>result_type</parameter> is an optional parameter that controls
how the return value is initialized.
<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_fetch_array</function>
will return an array with numerical indices, using
<constant>PGSQL_ASSOC</constant> will return only associative indices
while <constant>PGSQL_BOTH</constant>, the default, will return both
numerical and associative indices.
<note>
<para>
<function>pg_fetch_array</function> returns an array that
corresponds to the fetched row (tuples/records). It returns
&false;, if there are no more rows.
<parameter>result_type</parameter> was added in PHP 4.0.
</para>
<para>
<function>pg_fetch_array</function> is an extended version of
<function>pg_fetch_row</function>. In addition to storing the
data in the numeric indices (field index) to the result array, it
also stores the data in associative indices (field name) by
default.
</para>
&database.fetch-null;
<para>
<parameter>row</parameter> is row (record) number to be
retrieved. First row is 0.
</para>
<para>
<parameter>result_type</parameter> is an optional parameter that controls
how the return value is initialized.
<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_fetch_array</function>
will return an array with numerical indices, using
<constant>PGSQL_ASSOC</constant> will return only associative indices
while <constant>PGSQL_BOTH</constant>, the default, will return both
numerical and associative indices.
<note>
<para>
<parameter>result_type</parameter> was added in PHP 4.0.
</para>
</note>
</para>
<para>
<function>pg_fetch_array</function> is NOT significantly
slower than using <function>pg_fetch_row</function>, while it
provides a significant ease of use.
</para>
<para>
<example>
<title><function>pg_fetch_array</function> example</title>
<programlisting role="php">
</note>
</para>
<para>
<function>pg_fetch_array</function> is NOT significantly
slower than using <function>pg_fetch_row</function>, while it
provides a significant ease of use.
</para>
<para>
<example>
<title><function>pg_fetch_array</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
$result = pg_query($conn, "SELECT author, email FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
$arr = pg_fetch_array($result, 0, PGSQL_NUM);
@ -89,24 +89,24 @@ echo $arr[1] . " <- Row 3 E-mail\n";
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_array</function> will increment
the internal row counter by one.
</para>
</note>
<para>
See also
<function>pg_fetch_row</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_array</function> will increment
the internal row counter by one.
</para>
</note>
<para>
See also
<function>pg_fetch_row</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,84 +1,84 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-fetch-assoc">
<refnamediv>
<refname>pg_fetch_assoc</refname>
<refpurpose>Fetch a row as an associative array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_assoc</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_assoc</function> returns an associative array that
corresponds to the fetched row (tuples/records). It returns
&false;, if there are no more rows.
</para>
<para>
<function>pg_fetch_assoc</function> is equivalent to calling
<function>pg_fetch_array</function> with PGSQL_ASSOC for the
optional third parameter. It only returns an associative array.
If you need the numeric indices, use
<function>pg_fetch_row</function>.
</para>
&database.fetch-null;
<para>
<parameter>row</parameter> is row (record) number to be
retrieved. First row is 0.
</para>
<para>
<function>pg_fetch_assoc</function> is NOT significantly
slower than using <function>pg_fetch_row</function>, while it
provides a significant ease of use.
</para>
<para>
<example>
<title><function>pg_fetch_assoc</function> example</title>
<programlisting role="php">
<refentry id="function.pg-fetch-assoc">
<refnamediv>
<refname>pg_fetch_assoc</refname>
<refpurpose>Fetch a row as an associative array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_assoc</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_assoc</function> returns an associative array that
corresponds to the fetched row (tuples/records). It returns
&false;, if there are no more rows.
</para>
<para>
<function>pg_fetch_assoc</function> is equivalent to calling
<function>pg_fetch_array</function> with PGSQL_ASSOC for the
optional third parameter. It only returns an associative array.
If you need the numeric indices, use
<function>pg_fetch_row</function>.
</para>
&database.fetch-null;
<para>
<parameter>row</parameter> is row (record) number to be
retrieved. First row is 0.
</para>
<para>
<function>pg_fetch_assoc</function> is NOT significantly
slower than using <function>pg_fetch_row</function>, while it
provides a significant ease of use.
</para>
<para>
<example>
<title><function>pg_fetch_assoc</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_connect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
$result = pg_query($conn, "SELECT id, author, email FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
while ($row = pg_fetch_assoc($result)) {
echo $row['id'];
echo $row['author'];
echo $row['email'];
echo $row['id'];
echo $row['author'];
echo $row['email'];
}
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_assoc</function> will increment
the internal row counter by one.
</para>
</note>
<para>
See also
<function>pg_fetch_row</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_assoc</function> will increment
the internal row counter by one.
</para>
</note>
<para>
See also
<function>pg_fetch_row</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,56 +1,56 @@
<?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.2 -->
<refentry id="function.pg-fetch-object">
<refnamediv>
<refname>pg_fetch_object</refname>
<refpurpose>Fetch a row as an object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>pg_fetch_object</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_object</function> returns an object with
properties that correspond to the fetched row. It returns &false;
if there are no more rows or error.
</para>
<para>
<function>pg_fetch_object</function> is similar to
<function>pg_fetch_array</function>, with one difference - an
object is returned, instead of an array. Indirectly, that means
that you can only access the data by the field names, and not by
their offsets (numbers are illegal property names).
</para>
&database.fetch-null;
<para>
<parameter>row</parameter> is row (record) number to be
retrieved. First row is 0.
</para>
<para>
Speed-wise, the function is identical to
<function>pg_fetch_array</function>, and almost as quick as
<function>pg_fetch_row</function> (the difference is
insignificant).
</para>
<note>
<para>
From 4.3.0, <parameter>result_type</parameter> is default to PGSQL_ASSOC while
older versions' default was PGSQL_BOTH. There is no use for numeric property,
since numeric property name is invalid in PHP.
</para>
<para>
<parameter>result_type</parameter> may be deleted in future versions.
</para>
</note>
<para>
<example>
<title><function>pg_fetch_object</function> example</title>
<programlisting role="php">
<refentry id="function.pg-fetch-object">
<refnamediv>
<refname>pg_fetch_object</refname>
<refpurpose>Fetch a row as an object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>pg_fetch_object</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_object</function> returns an object with
properties that correspond to the fetched row. It returns &false;
if there are no more rows or error.
</para>
<para>
<function>pg_fetch_object</function> is similar to
<function>pg_fetch_array</function>, with one difference - an
object is returned, instead of an array. Indirectly, that means
that you can only access the data by the field names, and not by
their offsets (numbers are illegal property names).
</para>
&database.fetch-null;
<para>
<parameter>row</parameter> is row (record) number to be
retrieved. First row is 0.
</para>
<para>
Speed-wise, the function is identical to
<function>pg_fetch_array</function>, and almost as quick as
<function>pg_fetch_row</function> (the difference is
insignificant).
</para>
<note>
<para>
From 4.3.0, <parameter>result_type</parameter> is default to PGSQL_ASSOC while
older versions' default was PGSQL_BOTH. There is no use for numeric property,
since numeric property name is invalid in PHP.
</para>
<para>
<parameter>result_type</parameter> may be deleted in future versions.
</para>
</note>
<para>
<example>
<title><function>pg_fetch_object</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -58,8 +58,8 @@ $database = "store";
$db_conn = pg_connect("host=localhost port=5432 dbname=$database");
if (!$db_conn) {
echo "Failed connecting to postgres database $database\n";
exit;
echo "Failed connecting to postgres database $database\n";
exit;
}
$qu = pg_query($db_conn, "SELECT * FROM books ORDER BY author");
@ -67,10 +67,10 @@ $qu = pg_query($db_conn, "SELECT * FROM books ORDER BY author");
$row = 0; // postgres needs a row counter
while ($data = pg_fetch_object($qu, $row)) {
echo $data->author . " (";
echo $data->year . "): ";
echo $data->title . "<br />";
$row++;
echo $data->author . " (";
echo $data->year . "): ";
echo $data->title . "<br />";
$row++;
}
pg_free_result($qu);
@ -78,26 +78,26 @@ pg_close($db_conn);
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_object</function> will increment
the internal row counter counter by one.
</para>
</note>
<para>
See also
<function>pg_query</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_assoc</function>,
<function>pg_fetch_row</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_object</function> will increment
the internal row counter counter by one.
</para>
</note>
<para>
See also
<function>pg_query</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_assoc</function>,
<function>pg_fetch_row</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,51 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id="function.pg-fetch-result">
<refnamediv>
<refname>pg_fetch_result</refname>
<refpurpose>Returns values from a result resource</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>pg_fetch_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>mixed</type><methodname>pg_fetch_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_result</function> returns values from a
<parameter>result</parameter> resource returned by
<function>pg_query</function>. <parameter>row</parameter>
is integer. <parameter>field</parameter> is field name (string)
or field index (integer). The <parameter>row</parameter>
and <parameter>field</parameter> specify what cell in the table
of results to return. Row numbering starts from 0. Instead of
naming the field, you may use the field index as an unquoted
number. Field indices start from 0.
</para>
<para>
PostgreSQL has many built in types and only the basic ones are
directly supported here. All forms of <type>integer</type> <!--
FIXME: is that still true? PHP supports boolean&null now... -->
<!-- Yes, supporting boolean&null breaks
scripts. pg_fetch_array() can be used instead. I might take of
this issue with additional ini directive. yohgaki@php.net -->
types are returned as <type>integer</type> values. All forms of
float, and real types are returned as <type>float</type> values.
Boolean is returned as &quot;t&quot; or &quot;f&quot;. All
other types, including arrays are returned as strings formatted
in the same default PostgreSQL manner that you would see in the
<command>psql</command> program.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-fetch-result">
<refnamediv>
<refname>pg_fetch_result</refname>
<refpurpose>Returns values from a result resource</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>pg_fetch_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>mixed</type><methodname>pg_fetch_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_result</function> returns values from a
<parameter>result</parameter> resource returned by
<function>pg_query</function>. <parameter>row</parameter>
is integer. <parameter>field</parameter> is field name (string)
or field index (integer). The <parameter>row</parameter>
and <parameter>field</parameter> specify what cell in the table
of results to return. Row numbering starts from 0. Instead of
naming the field, you may use the field index as an unquoted
number. Field indices start from 0.
</para>
<para>
PostgreSQL has many built in types and only the basic ones are
directly supported here. All forms of <type>integer</type> <!--
FIXME: is that still true? PHP supports boolean&null now... -->
<!-- Yes, supporting boolean&null breaks
scripts. pg_fetch_array() can be used instead. I might take of
this issue with additional ini directive. yohgaki@php.net -->
types are returned as <type>integer</type> values. All forms of
float, and real types are returned as <type>float</type> values.
Boolean is returned as &quot;t&quot; or &quot;f&quot;. All
other types, including arrays are returned as strings formatted
in the same default PostgreSQL manner that you would see in the
<command>psql</command> program.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,75 +1,75 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- $Revision: 1.10 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-fetch-row">
<refnamediv>
<refname>pg_fetch_row</refname>
<refpurpose>Get a row as an enumerated array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_row</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_row</function> fetches one row of data from
the result associated with the specified
<parameter>result</parameter> resource. The row (record) is
returned as an array. Each result column is stored in an array
offset, starting at offset 0.
</para>
<para>
It returns an array that corresponds to the fetched row, or &false;
if there are no more rows.
</para>
&database.fetch-null;
<para>
<example>
<title><function>pg_fetch_row</function> example</title>
<programlisting role="php">
<refentry id="function.pg-fetch-row">
<refnamediv>
<refname>pg_fetch_row</refname>
<refpurpose>Get a row as an enumerated array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_fetch_row</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_fetch_row</function> fetches one row of data from
the result associated with the specified
<parameter>result</parameter> resource. The row (record) is
returned as an array. Each result column is stored in an array
offset, starting at offset 0.
</para>
<para>
It returns an array that corresponds to the fetched row, or &false;
if there are no more rows.
</para>
&database.fetch-null;
<para>
<example>
<title><function>pg_fetch_row</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
$result = pg_query($conn, "SELECT author, email FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
while ($row = pg_fetch_row($result)) {
echo "Author: $row[0] E-mail: $row[1]";
echo "<br />\n";
echo "Author: $row[0] E-mail: $row[1]";
echo "<br />\n";
}
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_row</function> will increment
the internal row counter by one.
</para>
</note>
<para>
See also
<function>pg_query</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
From 4.1.0, <parameter>row</parameter> became optional.
Calling <function>pg_fetch_row</function> will increment
the internal row counter by one.
</para>
</note>
<para>
See also
<function>pg_query</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,54 +1,54 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-field-is-null">
<refnamediv>
<refname>pg_field_is_null</refname>
<refpurpose>Test if a field is &null;</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_is_null</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_is_null</function> tests if a field is &null; or
not. It returns 1 if the field in the given row is &null;. It
returns 0 if the field in the given row is NOT &null;. Field can
be specified as column index (number) or fieldname (string). Row
numbering starts at 0.
</para>
<para>
<example>
<title><function>pg_field_is_null</function> example</title>
<programlisting role="php">
<refentry id="function.pg-field-is-null">
<refnamediv>
<refname>pg_field_is_null</refname>
<refpurpose>Test if a field is &null;</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_is_null</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_is_null</function> tests if a field is &null; or
not. It returns 1 if the field in the given row is &null;. It
returns 0 if the field in the given row is NOT &null;. Field can
be specified as column index (number) or fieldname (string). Row
numbering starts at 0.
</para>
<para>
<example>
<title><function>pg_field_is_null</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
$res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
if ($res) {
if (pg_field_is_null($res, 0, "year") == 1) {
echo "The value of the field year is null.\n";
}
if (pg_field_is_null($res, 0, "year") == 0) {
echo "The value of the field year is not null.\n";
$dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
$res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
if ($res) {
if (pg_field_is_null($res, 0, "year") == 1) {
echo "The value of the field year is null.\n";
}
}
if (pg_field_is_null($res, 0, "year") == 0) {
echo "The value of the field year is not null.\n";
}
}
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
This function used to be called <literal>pg_fieldisnull()</literal>.
</para>
</note>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
This function used to be called <literal>pg_fieldisnull()</literal>.
</para>
</note>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-field-name">
<refnamediv>
<refname>pg_field_name</refname>
<refpurpose>Returns the name of a field</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_field_name</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_name</function> returns the name of the field
occupying the given <parameter>field_number</parameter> in the
given PostgreSQL <parameter>result</parameter> resource. Field
numbering starts from 0.
</para>
<para>
<example>
<title>Getting information about fields</title>
<programlisting role="php">
<refentry id="function.pg-field-name">
<refnamediv>
<refname>pg_field_name</refname>
<refpurpose>Returns the name of a field</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_field_name</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_name</function> returns the name of the field
occupying the given <parameter>field_number</parameter> in the
given PostgreSQL <parameter>result</parameter> resource. Field
numbering starts from 0.
</para>
<para>
<example>
<title>Getting information about fields</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
$i = pg_num_fields($res);
for ($j = 0; $j < $i; $j++) {
echo "column $j\n";
$fieldname = pg_field_name($res, $j);
echo "fieldname: $fieldname\n";
echo "printed length: " . pg_field_prtlen($res, $fieldname) . " characters\n";
echo "storage length: " . pg_field_size($res, $j) . " bytes\n";
echo "field type: " . pg_field_type($res, $j) . " \n\n";
}
$res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
$i = pg_num_fields($res);
for ($j = 0; $j < $i; $j++) {
echo "column $j\n";
$fieldname = pg_field_name($res, $j);
echo "fieldname: $fieldname\n";
echo "printed length: " . pg_field_prtlen($res, $fieldname) . " characters\n";
echo "storage length: " . pg_field_size($res, $j) . " bytes\n";
echo "field type: " . pg_field_type($res, $j) . " \n\n";
}
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
column 0
fieldname: author
@ -63,19 +63,19 @@ printed length: 24 characters
storage length: -1 bytes
field type: varchar
]]>
</screen>
</example>
</para>
<note>
<para>
This function used to be called <literal>pg_fieldname()</literal>.
</para>
</note>
<para>
See also <function>pg_field_num</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<note>
<para>
This function used to be called <literal>pg_fieldname()</literal>.
</para>
</note>
<para>
See also <function>pg_field_num</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-field-num">
<refnamediv>
<refname>pg_field_num</refname>
<refpurpose>Returns the field number of the named field</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_num</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>string</type><parameter>field_name</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_num</function> will return the number of the
column (field) slot that corresponds to the
<parameter>field_name</parameter> in the given PostgreSQL
<parameter>result</parameter> resource. Field numbering starts
at 0. This function will return -1 on error.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldnum()</literal>.
</para>
</note>
<para>
See also <function>pg_field_name</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-field-num">
<refnamediv>
<refname>pg_field_num</refname>
<refpurpose>Returns the field number of the named field</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_num</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>string</type><parameter>field_name</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_num</function> will return the number of the
column (field) slot that corresponds to the
<parameter>field_name</parameter> in the given PostgreSQL
<parameter>result</parameter> resource. Field numbering starts
at 0. This function will return -1 on error.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldnum()</literal>.
</para>
</note>
<para>
See also <function>pg_field_name</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-field-prtlen">
<refnamediv>
<refname>pg_field_prtlen</refname>
<refpurpose>Returns the printed length</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_prtlen</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row_number</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field_name_or_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_prtlen</function> returns the actual printed
length (number of characters) of a specific value in a PostgreSQL
<parameter>result</parameter>. Row numbering starts at 0. This
function will return -1 on an error.
</para>
<para>
<parameter>field_name_or_number</parameter> can be passed either as an
<type>integer</type> or as a <type>string</type>. If it is passed as an
<type>integer</type>, PHP recognises it as the field number, otherwise as
field name.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldprtlen()</literal>.
</para>
</note>
<para>
See also <function>pg_field_size</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-field-prtlen">
<refnamediv>
<refname>pg_field_prtlen</refname>
<refpurpose>Returns the printed length</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_prtlen</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row_number</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field_name_or_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_prtlen</function> returns the actual printed
length (number of characters) of a specific value in a PostgreSQL
<parameter>result</parameter>. Row numbering starts at 0. This
function will return -1 on an error.
</para>
<para>
<parameter>field_name_or_number</parameter> can be passed either as an
<type>integer</type> or as a <type>string</type>. If it is passed as an
<type>integer</type>, PHP recognises it as the field number, otherwise as
field name.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldprtlen()</literal>.
</para>
</note>
<para>
See also <function>pg_field_size</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,41 +1,41 @@
<?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.2 -->
<refentry id="function.pg-field-size">
<refnamediv>
<refname>pg_field_size</refname>
<refpurpose>
Returns the internal storage size of the named field
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_size</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_size</function> returns the internal storage
size (in bytes) of the field number in the given PostgreSQL
<parameter>result</parameter>. Field numbering starts at 0. A
field size of -1 indicates a variable length field. This function
will return &false; on error.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldsize()</literal>.
</para>
</note>
<para>
See also <function>pg_field_prtlen</function> and
<function>pg_field_type</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-field-size">
<refnamediv>
<refname>pg_field_size</refname>
<refpurpose>
Returns the internal storage size of the named field
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_size</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_size</function> returns the internal storage
size (in bytes) of the field number in the given PostgreSQL
<parameter>result</parameter>. Field numbering starts at 0. A
field size of -1 indicates a variable length field. This function
will return &false; on error.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldsize()</literal>.
</para>
</note>
<para>
See also <function>pg_field_prtlen</function> and
<function>pg_field_type</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,36 +1,36 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.pg-field-type-oid">
<refnamediv>
<refname>pg_field_type_oid</refname>
<refpurpose>
Returns the type ID (OID) for the corresponding field number
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_type_oid</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_type_oid</function> returns an integer containing the
type ID the given <parameter>field_number</parameter> in the
given PostgreSQL <parameter>result</parameter> resource. Field
numbering starts at 0.
</para>
<para>
You can get more information about the field type by querying PostgreSQL
pg_type system table using the ID obtained with this function.
</para>
<para>
See also <function>pg_field_type</function>,
<function>pg_field_prtlen</function> and
<function>pg_field_name</function>.
</para>
</refsect1>
</refentry>
<!-- $Revision: 1.2 $ -->
<refentry id="function.pg-field-type-oid">
<refnamediv>
<refname>pg_field_type_oid</refname>
<refpurpose>
Returns the type ID (OID) for the corresponding field number
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_field_type_oid</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_type_oid</function> returns an integer containing the
type ID the given <parameter>field_number</parameter> in the
given PostgreSQL <parameter>result</parameter> resource. Field
numbering starts at 0.
</para>
<para>
You can get more information about the field type by querying PostgreSQL
pg_type system table using the ID obtained with this function.
</para>
<para>
See also <function>pg_field_type</function>,
<function>pg_field_prtlen</function> and
<function>pg_field_name</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,41 +1,41 @@
<?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.52 -->
<refentry id="function.pg-field-type">
<refnamediv>
<refname>pg_field_type</refname>
<refpurpose>
Returns the type name for the corresponding field number
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_field_type</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_type</function> returns a string containing the
type name of the given <parameter>field_number</parameter> in the
given PostgreSQL <parameter>result</parameter> resource. Field
numbering starts at 0.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldtype()</literal>.
</para>
</note>
<para>
See also <function>pg_field_prtlen</function>,
<function>pg_field_name</function> and
<function>pg_field_type_oid</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-field-type">
<refnamediv>
<refname>pg_field_type</refname>
<refpurpose>
Returns the type name for the corresponding field number
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_field_type</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_field_type</function> returns a string containing the
type name of the given <parameter>field_number</parameter> in the
given PostgreSQL <parameter>result</parameter> resource. Field
numbering starts at 0.
</para>
<para>
See the example given at the <function>pg_field_name</function> page.
</para>
<note>
<para>
This function used to be called <literal>pg_fieldtype()</literal>.
</para>
</note>
<para>
See also <function>pg_field_prtlen</function>,
<function>pg_field_name</function> and
<function>pg_field_type_oid</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-free-result">
<refnamediv>
<refname>pg_free_result</refname>
<refpurpose>Free result memory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_free_result</methodname>
<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;
</para>
<note>
<para>
This function used to be called <literal>pg_freeresult()</literal>.
</para>
</note>
<para>
See also <function>pg_query</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-free-result">
<refnamediv>
<refname>pg_free_result</refname>
<refpurpose>Free result memory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_free_result</methodname>
<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;
</para>
<note>
<para>
This function used to be called <literal>pg_freeresult()</literal>.
</para>
</note>
<para>
See also <function>pg_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,55 +1,55 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<refentry id="function.pg-get-notify">
<refnamediv>
<refname>pg_get_notify</refname>
<refpurpose>Ping database connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_get_notify</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<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.
</para>
<para>
See also <function>pg_get_pid</function>
</para>
<para>
<example>
<title>PostgreSQL NOTIFY message</title>
<programlisting role="php">
<!-- $Revision: 1.8 $ -->
<refentry id="function.pg-get-notify">
<refnamediv>
<refname>pg_get_notify</refname>
<refpurpose>Ping database connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_get_notify</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<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.
</para>
<para>
See also <function>pg_get_pid</function>
</para>
<para>
<example>
<title>PostgreSQL NOTIFY message</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
// Listen 'author_updated' message from other processes
pg_query($conn, 'LISTEN author_updated;');
$notify = pg_get_notify($conn);
if (!$notify) {
echo "No messages\n";
echo "No messages\n";
} else {
print_r($notify);
print_r($notify);
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,45 +1,45 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<refentry id="function.pg-get-pid">
<refnamediv>
<refname>pg_get_pid</refname>
<refpurpose>Ping database connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_get_pid</methodname>
<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.
</para>
<para>
<example>
<title>PostgreSQL backend PID</title>
<programlisting role="php">
<!-- $Revision: 1.3 $ -->
<refentry id="function.pg-get-pid">
<refnamediv>
<refname>pg_get_pid</refname>
<refpurpose>Ping database connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_get_pid</methodname>
<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.
</para>
<para>
<example>
<title>PostgreSQL backend PID</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
// Backend process PID. Use PID with pg_get_notify()
$pid = pg_get_pid($conn);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>pg_get_notify</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>pg_get_notify</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,30 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 -->
<refentry id='function.pg-get-result'>
<refnamediv>
<refname>pg_get_result</refname>
<refpurpose>
Get asynchronous query result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_get_result</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_get_result</function> get result resource from async
query executed by
<function>pg_send_query</function>. <function>pg_send_query</function>
can send multiple queries to PostgreSQL server and
<function>pg_get_result</function> is used to get query result
one by one. It returns result resource. If there is no more
results, it returns &false;.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-get-result'>
<refnamediv>
<refname>pg_get_result</refname>
<refpurpose>
Get asynchronous query result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_get_result</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_get_result</function> get result resource from async
query executed by
<function>pg_send_query</function>. <function>pg_send_query</function>
can send multiple queries to PostgreSQL server and
<function>pg_get_result</function> is used to get query result
one by one. It returns result resource. If there is no more
results, it returns &false;.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,30 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-host">
<refnamediv>
<refname>pg_host</refname>
<refpurpose>
Returns the host name associated with the connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_host</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_host</function> returns the host name of the given
PostgreSQL <parameter>connection</parameter> resource is
connected to.
</para>
<para>
See also <function>pg_connect</function> and
<function>pg_pconnect</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-host">
<refnamediv>
<refname>pg_host</refname>
<refpurpose>
Returns the host name associated with the connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_host</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_host</function> returns the host name of the given
PostgreSQL <parameter>connection</parameter> resource is
connected to.
</para>
<para>
See also <function>pg_connect</function> and
<function>pg_pconnect</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,58 +1,58 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-insert'>
<refnamediv>
<refname>pg_insert</refname>
<refpurpose>
Insert array into table
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_insert</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<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 as
well as the fieldvalues in <parameter>table_name</parameter>
must match the indices and values 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.
</para>
<para>
<example>
<title><function>pg_insert</function> example</title>
<programlisting role="php">
<refentry id='function.pg-insert'>
<refnamediv>
<refname>pg_insert</refname>
<refpurpose>
Insert array into table
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_insert</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<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 as
well as the fieldvalues in <parameter>table_name</parameter>
must match the indices and values 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.
</para>
<para>
<example>
<title><function>pg_insert</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect('dbname=foo');
// This is safe, since $_POST is converted automatically
$res = pg_insert($dbconn, 'post_log', $_POST);
if ($res) {
echo "POST data is successfully logged\n";
} else {
echo "User must have sent wrong inputs\n";
}
$dbconn = pg_connect('dbname=foo');
// This is safe, since $_POST is converted automatically
$res = pg_insert($dbconn, 'post_log', $_POST);
if ($res) {
echo "POST data is successfully logged\n";
} else {
echo "User must have sent wrong inputs\n";
}
?>
]]>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-last-error">
<refnamediv>
<refname>pg_last_error</refname>
<refpurpose>Get the last error message string of a connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_last_error</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_last_error</function> returns the last error message
for given <parameter>connection</parameter>.
</para>
<para>
Error messages may be overwritten by internal PostgreSQL(libpq)
function calls. It may not return appropriate error message, if
multiple errors are occurred inside a PostgreSQL module function.
</para>
<para>
Use <function>pg_result_error</function>,
<function>pg_result_status</function> and
<function>pg_connection_status</function> for better error handling.
</para>
<note>
<para>
This function used to be called <literal>pg_errormessage()</literal>.
</para>
</note>
<para>
See also <function>pg_result_error</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-last-error">
<refnamediv>
<refname>pg_last_error</refname>
<refpurpose>Get the last error message string of a connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_last_error</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_last_error</function> returns the last error message
for given <parameter>connection</parameter>.
</para>
<para>
Error messages may be overwritten by internal PostgreSQL(libpq)
function calls. It may not return appropriate error message, if
multiple errors are occurred inside a PostgreSQL module function.
</para>
<para>
Use <function>pg_result_error</function>,
<function>pg_result_status</function> and
<function>pg_connection_status</function> for better error handling.
</para>
<note>
<para>
This function used to be called <literal>pg_errormessage()</literal>.
</para>
</note>
<para>
See also <function>pg_result_error</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,58 +1,58 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id="function.pg-last-notice">
<refnamediv>
<refname>pg_last_notice</refname>
<refpurpose>
Returns the last notice message from PostgreSQL server
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_last_notice</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_last_notice</function> returns the last notice
message from the PostgreSQL server specified by
<parameter>connection</parameter>. The PostgreSQL server sends notice
messages in several cases, e.g. if the transactions can't be continued.
With <function>pg_last_notice</function>, you can avoid issuing useless
queries, by checking whether the notice is related to the transaction
or not.
</para>
<warning>
<para>
This function is EXPERIMENTAL and it is not fully implemented
yet. <function>pg_last_notice</function> was added in PHP
4.0.6. However, PHP 4.0.6 has problem with notice message
handling. Use of the PostgreSQL module with PHP 4.0.6 is not
recommended even if you are not using
<function>pg_last_notice</function>.
</para>
<para>
This function is fully implemented in PHP 4.3.0. PHP earlier than
PHP 4.3.0 ignores database connection parameter.
</para>
</warning>
<para>
Notice message tracking can be set to optional by setting 1 for
<literal>pgsql.ignore_notice</literal> in &php.ini; from PHP 4.3.0.
</para>
<para>
Notice message logging can be set to optional by setting 0 for
<literal>pgsql.log_notice</literal> in &php.ini; from PHP 4.3.0.
Unless <literal>pgsql.ignore_notice</literal> is set
to 0, notice message cannot be logged.
</para>
<para>
See also <function>pg_query</function> and
<function>pg_last_error</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-last-notice">
<refnamediv>
<refname>pg_last_notice</refname>
<refpurpose>
Returns the last notice message from PostgreSQL server
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_last_notice</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_last_notice</function> returns the last notice
message from the PostgreSQL server specified by
<parameter>connection</parameter>. The PostgreSQL server sends notice
messages in several cases, e.g. if the transactions can't be continued.
With <function>pg_last_notice</function>, you can avoid issuing useless
queries, by checking whether the notice is related to the transaction
or not.
</para>
<warning>
<para>
This function is EXPERIMENTAL and it is not fully implemented
yet. <function>pg_last_notice</function> was added in PHP
4.0.6. However, PHP 4.0.6 has problem with notice message
handling. Use of the PostgreSQL module with PHP 4.0.6 is not
recommended even if you are not using
<function>pg_last_notice</function>.
</para>
<para>
This function is fully implemented in PHP 4.3.0. PHP earlier than
PHP 4.3.0 ignores database connection parameter.
</para>
</warning>
<para>
Notice message tracking can be set to optional by setting 1 for
<literal>pgsql.ignore_notice</literal> in &php.ini; from PHP 4.3.0.
</para>
<para>
Notice message logging can be set to optional by setting 0 for
<literal>pgsql.log_notice</literal> in &php.ini; from PHP 4.3.0.
Unless <literal>pgsql.ignore_notice</literal> is set
to 0, notice message cannot be logged.
</para>
<para>
See also <function>pg_query</function> and
<function>pg_last_error</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id="function.pg-last-oid">
<refnamediv>
<refname>pg_last_oid</refname>
<refpurpose>Returns the last object's oid</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_last_oid</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_last_oid</function> is used to retrieve the
<varname>oid</varname> assigned to an inserted tuple (record) if
the result resource is used from the last command sent via
<function>pg_query</function> and was an SQL INSERT. Returns a
positive integer if there was a valid <varname>oid</varname>. It
returns &false; if an error occurs or the last command sent via
<function>pg_query</function> was not an INSERT or INSERT is
failed.
</para>
<para>
OID field became an optional field from PostgreSQL 7.2. When
OID field is not defined in a table, programmer must use
<function>pg_result_status</function> to check if record is
is inserted successfully or not.
</para>
<note>
<para>
This function used to be called <literal>pg_getlastoid()</literal>.
</para>
</note>
<para>
See also <function>pg_query</function> and
<function>pg_result_status</function>
</para>
</refsect1>
</refentry>
<refentry id="function.pg-last-oid">
<refnamediv>
<refname>pg_last_oid</refname>
<refpurpose>Returns the last object's oid</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_last_oid</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_last_oid</function> is used to retrieve the
<varname>oid</varname> assigned to an inserted tuple (record) if
the result resource is used from the last command sent via
<function>pg_query</function> and was an SQL INSERT. Returns a
positive integer if there was a valid <varname>oid</varname>. It
returns &false; if an error occurs or the last command sent via
<function>pg_query</function> was not an INSERT or INSERT is
failed.
</para>
<para>
OID field became an optional field from PostgreSQL 7.2. When
OID field is not defined in a table, programmer must use
<function>pg_result_status</function> to check if record is
is inserted successfully or not.
</para>
<note>
<para>
This function used to be called <literal>pg_getlastoid()</literal>.
</para>
</note>
<para>
See also <function>pg_query</function> and
<function>pg_result_status</function>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-lo-close">
<refnamediv>
<refname>pg_lo_close</refname>
<refpurpose>Close a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_close</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_close</function> closes a Large
Object. <parameter>large_object</parameter> is a resource for the
large object from <function>pg_lo_open</function>.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loclose()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_open</function>,
<function>pg_lo_create</function> and
<function>pg_lo_import</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-close">
<refnamediv>
<refname>pg_lo_close</refname>
<refpurpose>Close a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_close</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_close</function> closes a Large
Object. <parameter>large_object</parameter> is a resource for the
large object from <function>pg_lo_open</function>.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loclose()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_open</function>,
<function>pg_lo_create</function> and
<function>pg_lo_import</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,40 @@
<?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.2 -->
<refentry id="function.pg-lo-create">
<refnamediv>
<refname>pg_lo_create</refname>
<refpurpose>Create a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_create</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_create</function> creates a Large
Object and returns the <varname>oid</varname> of the large
object. <parameter>connection</parameter> specifies a valid
database connection opened by <function>pg_connect</function> or
<function>pg_pconnect</function>. PostgreSQL access modes
INV_READ, INV_WRITE, and INV_ARCHIVE are not supported, the
object is created always with both read and write
access. INV_ARCHIVE has been removed from PostgreSQL itself
(version 6.3 and above). It returns large object oid,
otherwise it returns &false; if an error occurred.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_locreate()</literal>.
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.pg-lo-create">
<refnamediv>
<refname>pg_lo_create</refname>
<refpurpose>Create a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_create</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_create</function> creates a Large
Object and returns the <varname>oid</varname> of the large
object. <parameter>connection</parameter> specifies a valid
database connection opened by <function>pg_connect</function> or
<function>pg_pconnect</function>. PostgreSQL access modes
INV_READ, INV_WRITE, and INV_ARCHIVE are not supported, the
object is created always with both read and write
access. INV_ARCHIVE has been removed from PostgreSQL itself
(version 6.3 and above). It returns large object oid,
otherwise it returns &false; if an error occurred.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_locreate()</literal>.
</para>
</note>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,39 +1,39 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.6 -->
<refentry id="function.pg-lo-export">
<refnamediv>
<refname>pg_lo_export</refname>
<refpurpose>Export a large object to file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_export</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>int</type><parameter>oid</parameter></methodparam>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
</methodsynopsis>
<para>
The <parameter>oid</parameter> argument specifies oid of the
large object to export and the <parameter>pathname</parameter>
argument specifies the pathname of the file. It returns &false; if
an error occurred, &true; otherwise.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loexport()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_import</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-export">
<refnamediv>
<refname>pg_lo_export</refname>
<refpurpose>Export a large object to file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_export</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>int</type><parameter>oid</parameter></methodparam>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
</methodsynopsis>
<para>
The <parameter>oid</parameter> argument specifies oid of the
large object to export and the <parameter>pathname</parameter>
argument specifies the pathname of the file. It returns &false; if
an error occurred, &true; otherwise.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loexport()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_import</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.6 -->
<refentry id="function.pg-lo-import">
<refnamediv>
<refname>pg_lo_import</refname>
<refpurpose>Import a large object from file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_import</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
</methodsynopsis>
<para>
In versions before PHP 4.2.0 the syntax of this function was different,
see the following definition:
</para>
<methodsynopsis>
<type>int</type><methodname>pg_lo_import</methodname>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
The <parameter>pathname</parameter> argument specifies the
pathname of the file to be imported as a large object. It returns
&false; if an error occurred, oid of the just created large
object otherwise.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
&note.sm.uidcheck;
<note>
<para>
This function used to be called <literal>pg_loimport()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_export</function> and
<function>pg_lo_open</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-import">
<refnamediv>
<refname>pg_lo_import</refname>
<refpurpose>Import a large object from file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_import</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
</methodsynopsis>
<para>
In versions before PHP 4.2.0 the syntax of this function was different,
see the following definition:
</para>
<methodsynopsis>
<type>int</type><methodname>pg_lo_import</methodname>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
The <parameter>pathname</parameter> argument specifies the
pathname of the file to be imported as a large object. It returns
&false; if an error occurred, oid of the just created large
object otherwise.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
&note.sm.uidcheck;
<note>
<para>
This function used to be called <literal>pg_loimport()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_export</function> and
<function>pg_lo_open</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-lo-open">
<refnamediv>
<refname>pg_lo_open</refname>
<refpurpose>Open a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_lo_open</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>int</type><parameter>oid</parameter></methodparam>
<methodparam><type>string</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_open</function> opens a Large Object and
returns large object resource. The resource encapsulates
information about the connection.
<parameter>oid</parameter> specifies a valid large object oid and
<parameter>mode</parameter> can be either "r", "w", or "rw". It
returns &false; if there is an error.
</para>
<warning>
<para>
Do not close the database connection before closing the large
object resource.
</para>
</warning>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loopen()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_close</function> and
<function>pg_lo_create</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-open">
<refnamediv>
<refname>pg_lo_open</refname>
<refpurpose>Open a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_lo_open</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>int</type><parameter>oid</parameter></methodparam>
<methodparam><type>string</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_open</function> opens a Large Object and
returns large object resource. The resource encapsulates
information about the connection.
<parameter>oid</parameter> specifies a valid large object oid and
<parameter>mode</parameter> can be either "r", "w", or "rw". It
returns &false; if there is an error.
</para>
<warning>
<para>
Do not close the database connection before closing the large
object resource.
</para>
</warning>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loopen()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_close</function> and
<function>pg_lo_create</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-lo-read-all">
<refnamediv>
<refname>pg_lo_read_all</refname>
<refpurpose>
Reads an entire large object and send straight to browser
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_read_all</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_read_all</function> reads a large object and passes
it straight through to the browser after sending all pending
headers. Mainly intended for sending binary data like images or
sound. It returns number of bytes read. It returns &false;, if an
error occurred.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loreadall()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_read</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-read-all">
<refnamediv>
<refname>pg_lo_read_all</refname>
<refpurpose>
Reads an entire large object and send straight to browser
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_read_all</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_read_all</function> reads a large object and passes
it straight through to the browser after sending all pending
headers. Mainly intended for sending binary data like images or
sound. It returns number of bytes read. It returns &false;, if an
error occurred.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loreadall()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_read</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.74 -->
<refentry id="function.pg-lo-read">
<refnamediv>
<refname>pg_lo_read</refname>
<refpurpose>Read a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_lo_read</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>len</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_read</function> reads at most
<parameter>len</parameter> (defaults to 8192) bytes from a large object and
returns it as a string. <parameter>large_object</parameter> specifies a
valid large object resource and<parameter>len</parameter>
specifies the maximum allowable size of the large object
segment. It returns &false; if there is an error.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loread()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_read_all</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-read">
<refnamediv>
<refname>pg_lo_read</refname>
<refpurpose>Read a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_lo_read</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>len</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_read</function> reads at most
<parameter>len</parameter> (defaults to 8192) bytes from a large object and
returns it as a string. <parameter>large_object</parameter> specifies a
valid large object resource and<parameter>len</parameter>
specifies the maximum allowable size of the large object
segment. It returns &false; if there is an error.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_loread()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_read_all</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id='function.pg-lo-seek'>
<refnamediv>
<refname>pg_lo_seek</refname>
<refpurpose>
Seeks position of large object
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_seek</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>whence</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_seek</function> seeks position of large object
resource. <parameter>whence</parameter> is PGSQL_SEEK_SET,
PGSQL_SEEK_CUR or PGSQL_SEEK_END.
</para>
<para>
See also <function>pg_lo_tell</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-lo-seek'>
<refnamediv>
<refname>pg_lo_seek</refname>
<refpurpose>
Seeks position of large object
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_seek</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>whence</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_seek</function> seeks position of large object
resource. <parameter>whence</parameter> is PGSQL_SEEK_SET,
PGSQL_SEEK_CUR or PGSQL_SEEK_END.
</para>
<para>
See also <function>pg_lo_tell</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.74 -->
<refentry id='function.pg-lo-tell'>
<refnamediv>
<refname>pg_lo_tell</refname>
<refpurpose>
Returns current position of large object
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_tell</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_tell</function> returns current position (offset
from the beginning of large object).
</para>
<para>
See also <function>pg_lo_seek</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-lo-tell'>
<refnamediv>
<refname>pg_lo_tell</refname>
<refpurpose>
Returns current position of large object
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_tell</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_tell</function> returns current position (offset
from the beginning of large object).
</para>
<para>
See also <function>pg_lo_seek</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-lo-unlink">
<refnamediv>
<refname>pg_lo_unlink</refname>
<refpurpose>Delete a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_unlink</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>int</type><parameter>oid</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_unlink</function> deletes a large object with the
<parameter>oid</parameter>. &return.success;
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_lo_unlink()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_create</function> and
<function>pg_lo_import</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-unlink">
<refnamediv>
<refname>pg_lo_unlink</refname>
<refpurpose>Delete a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_lo_unlink</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>int</type><parameter>oid</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_unlink</function> deletes a large object with the
<parameter>oid</parameter>. &return.success;
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_lo_unlink()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_create</function> and
<function>pg_lo_import</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-lo-write">
<refnamediv>
<refname>pg_lo_write</refname>
<refpurpose>Write a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_write</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>len</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_write</function> writes at most to a large object
from a variable <parameter>data</parameter> and returns the number
of bytes actually written, or &false; in the case of an error.
<parameter>large_object</parameter> is a large object resource
from <function>pg_lo_open</function>.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_lowrite()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_create</function> and
<function>pg_lo_open</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-lo-write">
<refnamediv>
<refname>pg_lo_write</refname>
<refpurpose>Write a large object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_lo_write</methodname>
<methodparam><type>resource</type><parameter>large_object</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>len</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_write</function> writes at most to a large object
from a variable <parameter>data</parameter> and returns the number
of bytes actually written, or &false; in the case of an error.
<parameter>large_object</parameter> is a large object resource
from <function>pg_lo_open</function>.
</para>
<para>
To use the large object (lo) interface, it is necessary to
enclose it within a transaction block.
</para>
<note>
<para>
This function used to be called <literal>pg_lowrite()</literal>.
</para>
</note>
<para>
See also <function>pg_lo_create</function> and
<function>pg_lo_open</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,98 +1,98 @@
<?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.80 -->
<refentry id='function.pg-meta-data'>
<refnamediv>
<refname>pg_meta_data</refname>
<refpurpose>
Get meta data for table
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_meta_data</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_meta_data</function> returns table definition for
<literal>table_name</literal> as an array. If there is error, it
returns &false;
</para>
<para>
<example>
<title>Getting table metadata</title>
<programlisting role="php">
<refentry id='function.pg-meta-data'>
<refnamediv>
<refname>pg_meta_data</refname>
<refpurpose>
Get meta data for table
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_meta_data</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_meta_data</function> returns table definition for
<literal>table_name</literal> as an array. If there is error, it
returns &false;
</para>
<para>
<example>
<title>Getting table metadata</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$meta = pg_meta_data($dbconn, 'authors');
if (is_array($meta)) {
echo '<pre>';
var_dump($meta);
echo '</pre>';
}
$meta = pg_meta_data($dbconn, 'authors');
if (is_array($meta)) {
echo '<pre>';
var_dump($meta);
echo '</pre>';
}
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
array(3) {
["author"]=>
array(5) {
["num"]=>
int(1)
["type"]=>
string(7) "varchar"
["len"]=>
int(-1)
["not null"]=>
bool(false)
["has default"]=>
bool(false)
}
["year"]=>
array(5) {
["num"]=>
int(2)
["type"]=>
string(4) "int2"
["len"]=>
int(2)
["not null"]=>
bool(false)
["has default"]=>
bool(false)
}
["title"]=>
array(5) {
["num"]=>
int(3)
["type"]=>
string(7) "varchar"
["len"]=>
int(-1)
["not null"]=>
bool(false)
["has default"]=>
bool(false)
}
["author"]=>
array(5) {
["num"]=>
int(1)
["type"]=>
string(7) "varchar"
["len"]=>
int(-1)
["not null"]=>
bool(false)
["has default"]=>
bool(false)
}
["year"]=>
array(5) {
["num"]=>
int(2)
["type"]=>
string(4) "int2"
["len"]=>
int(2)
["not null"]=>
bool(false)
["has default"]=>
bool(false)
}
["title"]=>
array(5) {
["num"]=>
int(3)
["type"]=>
string(7) "varchar"
["len"]=>
int(-1)
["not null"]=>
bool(false)
["has default"]=>
bool(false)
}
}
]]>
</screen>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-num-fields">
<refnamediv>
<refname>pg_num_fields</refname>
<refpurpose>Returns the number of fields</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_num_fields</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_num_fields</function> returns the number of fields
(columns) in a PostgreSQL <parameter>result</parameter>. The
argument is a result resource returned by
<function>pg_query</function>. This function will return -1 on
error.
</para>
<note>
<para>
This function used to be called <literal>pg_numfields()</literal>.
</para>
</note>
<para>
See also <function>pg_num_rows</function> and
<function>pg_affected_rows</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-num-fields">
<refnamediv>
<refname>pg_num_fields</refname>
<refpurpose>Returns the number of fields</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_num_fields</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_num_fields</function> returns the number of fields
(columns) in a PostgreSQL <parameter>result</parameter>. The
argument is a result resource returned by
<function>pg_query</function>. This function will return -1 on
error.
</para>
<note>
<para>
This function used to be called <literal>pg_numfields()</literal>.
</para>
</note>
<para>
See also <function>pg_num_rows</function> and
<function>pg_affected_rows</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-num-rows">
<refnamediv>
<refname>pg_num_rows</refname>
<refpurpose>Returns the number of rows</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_num_rows</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_num_rows</function> will return the number of rows in
a PostgreSQL <parameter>result</parameter> resource.
<parameter>result</parameter> is a query result resource returned
by <function>pg_query</function>. This function will return -1 on
error.
</para>
<note>
<para>
Use <function>pg_affected_rows</function> to get number of rows
affected by INSERT, UPDATE and DELETE query.
</para>
</note>
<note>
<para>
This function used to be called <literal>pg_numrows()</literal>.
</para>
</note>
<para>
See also <function>pg_num_fields</function> and
<function>pg_affected_rows</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-num-rows">
<refnamediv>
<refname>pg_num_rows</refname>
<refpurpose>Returns the number of rows</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_num_rows</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_num_rows</function> will return the number of rows in
a PostgreSQL <parameter>result</parameter> resource.
<parameter>result</parameter> is a query result resource returned
by <function>pg_query</function>. This function will return -1 on
error.
</para>
<note>
<para>
Use <function>pg_affected_rows</function> to get number of rows
affected by INSERT, UPDATE and DELETE query.
</para>
</note>
<note>
<para>
This function used to be called <literal>pg_numrows()</literal>.
</para>
</note>
<para>
See also <function>pg_num_fields</function> and
<function>pg_affected_rows</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-options">
<refnamediv>
<refname>pg_options</refname>
<refpurpose>Get the options associated with the connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_options</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_options</function> will return a string containing
the options specified on the given PostgreSQL
<parameter>connection</parameter> resource.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-options">
<refnamediv>
<refname>pg_options</refname>
<refpurpose>Get the options associated with the connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_options</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_options</function> will return a string containing
the options specified on the given PostgreSQL
<parameter>connection</parameter> resource.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,49 +1,49 @@
<?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.82 -->
<refentry id="function.pg-pconnect">
<refnamediv>
<refname>pg_pconnect</refname>
<refpurpose>Open a persistent PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_pconnect</methodname>
<methodparam><type>string</type><parameter>connection_string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>connect_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_pconnect</function> opens a connection to a
PostgreSQL database. It returns a connection resource that is
needed by other PostgreSQL functions.
</para>
<para>
For a description of the <parameter>connection_string</parameter>
parameter, see <function>pg_connect</function>.
</para>
<para>
To enable persistent connection, the <link
linkend="ini.pgsql.allow-persistent">pgsql.allow_persistent</link>
&php.ini; directive must be set to &quot;On&quot; (which is the default).
The maximum number of persistent connection can be defined with the <link
linkend="ini.pgsql.max-persistent">pgsql.max_persistent</link>
&php.ini; directive (defaults to -1 for no limit). The total number
of connections can be set with the <link
linkend="ini.pgsql.max-links">pgsql.max_links</link>
&php.ini; directive.
</para>
<para>
<function>pg_close</function> will not close persistent links
generated by <function>pg_pconnect</function>.
</para>
<para>
See also <function>pg_connect</function>, and the section
<link linkend="features.persistent-connections">Persistent Database
Connections</link> for more information.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-pconnect">
<refnamediv>
<refname>pg_pconnect</refname>
<refpurpose>Open a persistent PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_pconnect</methodname>
<methodparam><type>string</type><parameter>connection_string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>connect_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_pconnect</function> opens a connection to a
PostgreSQL database. It returns a connection resource that is
needed by other PostgreSQL functions.
</para>
<para>
For a description of the <parameter>connection_string</parameter>
parameter, see <function>pg_connect</function>.
</para>
<para>
To enable persistent connection, the <link
linkend="ini.pgsql.allow-persistent">pgsql.allow_persistent</link>
&php.ini; directive must be set to &quot;On&quot; (which is the default).
The maximum number of persistent connection can be defined with the <link
linkend="ini.pgsql.max-persistent">pgsql.max_persistent</link>
&php.ini; directive (defaults to -1 for no limit). The total number
of connections can be set with the <link
linkend="ini.pgsql.max-links">pgsql.max_links</link>
&php.ini; directive.
</para>
<para>
<function>pg_close</function> will not close persistent links
generated by <function>pg_pconnect</function>.
</para>
<para>
See also <function>pg_connect</function>, and the section
<link linkend="features.persistent-connections">Persistent Database
Connections</link> for more information.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,47 +1,47 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-ping">
<refnamediv>
<refname>pg_ping</refname>
<refpurpose>Ping database connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_ping</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_ping</function> ping database connection, try to
reconnect if it is broken. It returns &true; if connection is
alive, otherwise &false;.
</para>
<para>
<example>
<title><function>pg_ping</function> example</title>
<programlisting role="php">
<refentry id="function.pg-ping">
<refnamediv>
<refname>pg_ping</refname>
<refpurpose>Ping database connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_ping</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_ping</function> ping database connection, try to
reconnect if it is broken. It returns &true; if connection is
alive, otherwise &false;.
</para>
<para>
<example>
<title><function>pg_ping</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
echo "An error occured.\n";
exit;
}
if (!pg_ping($conn))
die("Connection is broken\n");
die("Connection is broken\n");
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connection_status</function> and
<function>pg_connection_reset</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connection_status</function> and
<function>pg_connection_reset</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.20 -->
<refentry id="function.pg-port">
<refnamediv>
<refname>pg_port</refname>
<refpurpose>
Return the port number associated with the connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_port</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_port</function> returns the port number that the
given PostgreSQL <parameter>connection</parameter> resource is
connected to.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-port">
<refnamediv>
<refname>pg_port</refname>
<refpurpose>
Return the port number associated with the connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_port</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_port</function> returns the port number that the
given PostgreSQL <parameter>connection</parameter> resource is
connected to.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,68 +1,68 @@
<?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.20 -->
<refentry id="function.pg-put-line">
<refnamediv>
<refname>pg_put_line</refname>
<refpurpose>Send a NULL-terminated string to PostgreSQL backend</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_put_line</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>bool</type><methodname>pg_put_line</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_put_line</function> sends a NULL-terminated string
to the PostgreSQL backend server. This is useful for example for
very high-speed inserting of data into a table, initiated by
starting a PostgreSQL copy-operation. That final NULL-character
is added automatically. &return.success;
</para>
<note>
<para>
The application must explicitly send the two characters "\."
on the last line to indicate to the backend that it has finished
sending its data.
</para>
</note>
<para>
<example>
<title>High-speed insertion of data into a table</title>
<programlisting role="php">
<refentry id="function.pg-put-line">
<refnamediv>
<refname>pg_put_line</refname>
<refpurpose>Send a NULL-terminated string to PostgreSQL backend</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_put_line</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>bool</type><methodname>pg_put_line</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_put_line</function> sends a NULL-terminated string
to the PostgreSQL backend server. This is useful for example for
very high-speed inserting of data into a table, initiated by
starting a PostgreSQL copy-operation. That final NULL-character
is added automatically. &return.success;
</para>
<note>
<para>
The application must explicitly send the two characters "\."
on the last line to indicate to the backend that it has finished
sending its data.
</para>
</note>
<para>
<example>
<title>High-speed insertion of data into a table</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=foo");
pg_query($conn, "create table bar (a int4, b char(16), d float8)");
pg_query($conn, "copy bar from stdin");
pg_put_line($conn, "3\thello world\t4.5\n");
pg_put_line($conn, "4\tgoodbye world\t7.11\n");
pg_put_line($conn, "\\.\n");
pg_end_copy($conn);
$conn = pg_pconnect("dbname=foo");
pg_query($conn, "create table bar (a int4, b char(16), d float8)");
pg_query($conn, "copy bar from stdin");
pg_put_line($conn, "3\thello world\t4.5\n");
pg_put_line($conn, "4\tgoodbye world\t7.11\n");
pg_put_line($conn, "\\.\n");
pg_end_copy($conn);
?>
]]>
</programlisting>
</example>
</para>
<warning>
<para>
Use of the <function>pg_put_line</function> causes most large object
operations, including <function>pg_lo_read</function> and
<function>pg_lo_tell</function>, to subsequently fail. You can use
<function>pg_copy_from</function> and <function>pg_copy_to</function>
instead.
</para>
</warning>
<para>
See also <function>pg_end_copy</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<warning>
<para>
Use of the <function>pg_put_line</function> causes most large object
operations, including <function>pg_lo_read</function> and
<function>pg_lo_tell</function>, to subsequently fail. You can use
<function>pg_copy_from</function> and <function>pg_copy_to</function>
instead.
</para>
</warning>
<para>
See also <function>pg_end_copy</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,70 +1,70 @@
<?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-query">
<refnamediv>
<refname>pg_query</refname>
<refpurpose>Execute a query</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>resource</type><methodname>pg_query</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_query</function> returns a query result resource if
query could be executed. It returns &false; on failure or if
connection is not a valid connection. Details about the error can
be retrieved using the <function>pg_last_error</function>
function if connection is valid.
<function>pg_query</function> sends an SQL statement to
the PostgreSQL database specified by the
<parameter>connection</parameter> resource. The
<parameter>connection</parameter> must be a valid connection that
was returned by <function>pg_connect</function> or
<function>pg_pconnect</function>. The return value of this
function is an query result resource to be used to access the
results from other PostgreSQL functions such as
<function>pg_fetch_array</function>.
<note>
<simpara>
<parameter>connection</parameter> is an optional parameter for
<function>pg_query</function>. If
<parameter>connection</parameter> is not set, default
connection is used. Default connection is the last connection
made by <function>pg_connect</function> or
<function>pg_pconnect</function>.
</simpara>
<simpara>
Although <parameter>connection</parameter> can be omitted, it
is not recommended, since it could be a cause of hard to find
bug in script.
</simpara>
</note>
</para>
<note>
<para>
This function used to be called <literal>pg_exec()</literal>.
<literal>pg_exec()</literal> is still available for compatibility
reasons but users are encouraged to use the newer name.
</para>
</note>
<para>
See also <function>pg_connect</function>,
<function>pg_pconnect</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function>,
<function>pg_num_rows</function> and
<function>pg_affected_rows</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-query">
<refnamediv>
<refname>pg_query</refname>
<refpurpose>Execute a query</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>pg_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>resource</type><methodname>pg_query</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_query</function> returns a query result resource if
query could be executed. It returns &false; on failure or if
connection is not a valid connection. Details about the error can
be retrieved using the <function>pg_last_error</function>
function if connection is valid.
<function>pg_query</function> sends an SQL statement to
the PostgreSQL database specified by the
<parameter>connection</parameter> resource. The
<parameter>connection</parameter> must be a valid connection that
was returned by <function>pg_connect</function> or
<function>pg_pconnect</function>. The return value of this
function is an query result resource to be used to access the
results from other PostgreSQL functions such as
<function>pg_fetch_array</function>.
<note>
<simpara>
<parameter>connection</parameter> is an optional parameter for
<function>pg_query</function>. If
<parameter>connection</parameter> is not set, default
connection is used. Default connection is the last connection
made by <function>pg_connect</function> or
<function>pg_pconnect</function>.
</simpara>
<simpara>
Although <parameter>connection</parameter> can be omitted, it
is not recommended, since it could be a cause of hard to find
bug in script.
</simpara>
</note>
</para>
<note>
<para>
This function used to be called <literal>pg_exec()</literal>.
<literal>pg_exec()</literal> is still available for compatibility
reasons but users are encouraged to use the newer name.
</para>
</note>
<para>
See also <function>pg_connect</function>,
<function>pg_pconnect</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function>,
<function>pg_num_rows</function> and
<function>pg_affected_rows</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,39 +1,39 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id='function.pg-result-error'>
<refnamediv>
<refname>pg_result_error</refname>
<refpurpose>
Get error message associated with result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_result_error</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_result_error</function> returns error message
associated with <parameter>result</parameter> resource. Therefore,
user has better chance to get better error message than
<function>pg_last_error</function>.
</para>
<para>
Because <function>pg_query</function> returns &false; if the query fails,
you must use <function>pg_send_query</function> and
<function>pg_get_result</function> to get the result handle.
</para>
<para>
See also <function>pg_query</function>,
<function>pg_send_query</function>,
<function>pg_get_result</function>,
<function>pg_last_error</function> and
<function>pg_last_notice</function>
</para>
</refsect1>
</refentry>
<refentry id='function.pg-result-error'>
<refnamediv>
<refname>pg_result_error</refname>
<refpurpose>
Get error message associated with result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_result_error</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_result_error</function> returns error message
associated with <parameter>result</parameter> resource. Therefore,
user has better chance to get better error message than
<function>pg_last_error</function>.
</para>
<para>
Because <function>pg_query</function> returns &false; if the query fails,
you must use <function>pg_send_query</function> and
<function>pg_get_result</function> to get the result handle.
</para>
<para>
See also <function>pg_query</function>,
<function>pg_send_query</function>,
<function>pg_get_result</function>,
<function>pg_last_error</function> and
<function>pg_last_notice</function>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-result-seek">
<refnamediv>
<refname>pg_result_seek</refname>
<refpurpose>Set internal row offset in result resource</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_result_seek</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_result_seek</function> set internal row offset in
result resource. It returns &false;, if there is error.
</para>
<para>
See also <function>pg_fetch_row</function>,
<function>pg_fetch_assoc</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-result-seek">
<refnamediv>
<refname>pg_result_seek</refname>
<refpurpose>Set internal row offset in result resource</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_result_seek</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_result_seek</function> set internal row offset in
result resource. It returns &false;, if there is error.
</para>
<para>
See also <function>pg_fetch_row</function>,
<function>pg_fetch_assoc</function>,
<function>pg_fetch_array</function>,
<function>pg_fetch_object</function> and
<function>pg_fetch_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 -->
<refentry id='function.pg-result-status'>
<refnamediv>
<refname>pg_result_status</refname>
<refpurpose>
Get status of query result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_result_status</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_result_status</function> returns status of result
resource. Possible return values are PGSQL_EMPTY_QUERY,
PGSQL_COMMAND_OK, PGSQL_TUPLES_OK, PGSQL_COPY_TO,
PGSQL_COPY_FROM, PGSQL_BAD_RESPONSE, PGSQL_NONFATAL_ERROR and
PGSQL_FATAL_ERROR.
</para>
<para>
See also <function>pg_connection_status</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.pg-result-status'>
<refnamediv>
<refname>pg_result_status</refname>
<refpurpose>
Get status of query result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_result_status</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_result_status</function> returns status of result
resource. Possible return values are PGSQL_EMPTY_QUERY,
PGSQL_COMMAND_OK, PGSQL_TUPLES_OK, PGSQL_COPY_TO,
PGSQL_COPY_FROM, PGSQL_BAD_RESPONSE, PGSQL_NONFATAL_ERROR and
PGSQL_FATAL_ERROR.
</para>
<para>
See also <function>pg_connection_status</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,58 +1,58 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-select'>
<refnamediv>
<refname>pg_select</refname>
<refpurpose>
Select records
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_select</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_select</function> selects records specified by
<literal>assoc_array</literal> which has
<literal>field=>value</literal>. For successful query, it returns
array contains all records and fields that match the condition
specified by <literal>assoc_array</literal>. If
<literal>options</literal> is specified,
<function>pg_convert</function> is applied to
<literal>assoc_array</literal> with specified option.
</para>
<para>
<example>
<title><function>pg_select</function> example</title>
<programlisting role="php">
<refentry id='function.pg-select'>
<refnamediv>
<refname>pg_select</refname>
<refpurpose>
Select records
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>pg_select</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>assoc_array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_select</function> selects records specified by
<literal>assoc_array</literal> which has
<literal>field=>value</literal>. For successful query, it returns
array contains all records and fields that match the condition
specified by <literal>assoc_array</literal>. If
<literal>options</literal> is specified,
<function>pg_convert</function> is applied to
<literal>assoc_array</literal> with specified option.
</para>
<para>
<example>
<title><function>pg_select</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$db = pg_connect('dbname=foo');
// This is safe, since $_POST is converted automatically
$rec = pg_select($db, 'post_log', $_POST);
if ($rec) {
echo "Records selected\n";
var_dump($rec);
} else {
echo "User must have sent wrong inputs\n";
}
$db = pg_connect('dbname=foo');
// This is safe, since $_POST is converted automatically
$rec = pg_select($db, 'post_log', $_POST);
if ($rec) {
echo "Records selected\n";
var_dump($rec);
} else {
echo "User must have sent wrong inputs\n";
}
?>
]]>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,69 +1,69 @@
<?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-send-query'>
<refnamediv>
<refname>pg_send_query</refname>
<refpurpose>
Sends asynchronous query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_send_query</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>bool</type><methodname>pg_send_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_send_query</function> send asynchronous query to the
<parameter>connection</parameter>. Unlike
<function>pg_query</function>, it can send multiple query to
PostgreSQL and get the result one by one using
<function>pg_get_result</function>. Script execution is not blocked
while query is executing. Use
<function>pg_connection_busy</function> to check connection is
busy (i.e. query is executing). Query may be cancelled by calling
<function>pg_cancel_query</function>.
</para>
<para>
Although user can send multiple query at once, user cannot send
multiple query over busy connection. If query is sent while
connection is busy, it waits until last query is finished and
discards all result.
</para>
<para>
<example>
<title>Asynchronous Queries</title>
<programlisting role="php">
<refentry id='function.pg-send-query'>
<refnamediv>
<refname>pg_send_query</refname>
<refpurpose>
Sends asynchronous query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_send_query</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>bool</type><methodname>pg_send_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_send_query</function> send asynchronous query to the
<parameter>connection</parameter>. Unlike
<function>pg_query</function>, it can send multiple query to
PostgreSQL and get the result one by one using
<function>pg_get_result</function>. Script execution is not blocked
while query is executing. Use
<function>pg_connection_busy</function> to check connection is
busy (i.e. query is executing). Query may be cancelled by calling
<function>pg_cancel_query</function>.
</para>
<para>
Although user can send multiple query at once, user cannot send
multiple query over busy connection. If query is sent while
connection is busy, it waits until last query is finished and
discards all result.
</para>
<para>
<example>
<title>Asynchronous Queries</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
}
$res1 = pg_get_result($dbconn);
echo "First call to pg_get_result(): $res1\n";
$rows1 = pg_num_rows($res1);
echo "$res1 has $rows1 records\n\n";
$res2 = pg_get_result($dbconn);
echo "second call to pg_get_result(): $res2\n";
$rows2 = pg_num_rows($res2);
echo "$res2 has $rows2 records\n";
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
}
$res1 = pg_get_result($dbconn);
echo "First call to pg_get_result(): $res1\n";
$rows1 = pg_num_rows($res1);
echo "$res1 has $rows1 records\n\n";
$res2 = pg_get_result($dbconn);
echo "second call to pg_get_result(): $res2\n";
$rows2 = pg_num_rows($res2);
echo "$res2 has $rows2 records\n";
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
first call to pg_get_result(): Resource id #3
Resource id #3 has 3 records
@ -71,17 +71,17 @@ Resource id #3 has 3 records
second call to pg_get_result(): Resource id #4
Resource id #4 has 1 records
]]>
</screen>
</example>
</para>
<para>
See also <function>pg_query</function>,
<function>pg_cancel_query</function>,
<function>pg_get_result</function> and
<function>pg_connection_busy</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>pg_query</function>,
<function>pg_cancel_query</function>,
<function>pg_get_result</function> and
<function>pg_connection_busy</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,52 +1,52 @@
<?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.16 -->
<refentry id="function.pg-set-client-encoding">
<refnamediv>
<refname>pg_set_client_encoding</refname>
<refpurpose>
Set the client encoding
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_set_client_encoding</methodname>
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>int</type><methodname>pg_set_client_encoding</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_set_client_encoding</function> sets the client
encoding and returns 0 if success or -1 if error.
</para>
<para>
<parameter>encoding</parameter> is the client encoding and can be
either : SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE,
MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT, SJIS, BIG5,
WIN1250. Available encoding depends on your PostgreSQL and libpq
version. Refer to PostgreSQL manual for supported encodings for
your PostgreSQL.
</para>
<note>
<para>
This function requires PHP-4.0.3 or higher and PostgreSQL-7.0 or
higher. Supported encoding depends on PostgreSQL version. Refer
to PostgreSQL manual for details.
</para>
<para>
The function used to be called
<literal>pg_setclientencoding()</literal>.
</para>
</note>
<para>
See also <function>pg_client_encoding</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-set-client-encoding">
<refnamediv>
<refname>pg_set_client_encoding</refname>
<refpurpose>
Set the client encoding
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>pg_set_client_encoding</methodname>
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>int</type><methodname>pg_set_client_encoding</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_set_client_encoding</function> sets the client
encoding and returns 0 if success or -1 if error.
</para>
<para>
<parameter>encoding</parameter> is the client encoding and can be
either : SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE,
MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT, SJIS, BIG5,
WIN1250. Available encoding depends on your PostgreSQL and libpq
version. Refer to PostgreSQL manual for supported encodings for
your PostgreSQL.
</para>
<note>
<para>
This function requires PHP-4.0.3 or higher and PostgreSQL-7.0 or
higher. Supported encoding depends on PostgreSQL version. Refer
to PostgreSQL manual for details.
</para>
<para>
The function used to be called
<literal>pg_setclientencoding()</literal>.
</para>
</note>
<para>
See also <function>pg_client_encoding</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.7 -->
<refentry id="function.pg-trace">
<refnamediv>
<refname>pg_trace</refname>
<refpurpose>Enable tracing a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_trace</methodname>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>mode</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_trace</function> enables tracing of the PostgreSQL
frontend/backend communication to a debugging file specified as
<parameter>pathname</parameter>. To fully understand the results,
one needs to be familiar with the internals of PostgreSQL
communication protocol. For those who are not, it can still be
useful for tracing errors in queries sent to the server, you
could do for example <command>grep '^To backend'
trace.log</command> and see what query actually were sent to the
PostgreSQL server. For more information, refer to PostgreSQL
manual.
</para>
<para>
<parameter>pathname</parameter> and <parameter>mode</parameter>
are the same as in <function>fopen</function>
(<parameter>mode</parameter> defaults to 'w'),
<parameter>connection</parameter> specifies the connection to
trace and defaults to the last one opened.
</para>
<para>
<function>pg_trace</function> returns &true; if
<parameter>pathname</parameter> could be opened for logging,
&false; otherwise.
</para>
<para>
See also <function>fopen</function> and
<function>pg_untrace</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-trace">
<refnamediv>
<refname>pg_trace</refname>
<refpurpose>Enable tracing a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_trace</methodname>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>mode</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_trace</function> enables tracing of the PostgreSQL
frontend/backend communication to a debugging file specified as
<parameter>pathname</parameter>. To fully understand the results,
one needs to be familiar with the internals of PostgreSQL
communication protocol. For those who are not, it can still be
useful for tracing errors in queries sent to the server, you
could do for example <command>grep '^To backend'
trace.log</command> and see what query actually were sent to the
PostgreSQL server. For more information, refer to PostgreSQL
manual.
</para>
<para>
<parameter>pathname</parameter> and <parameter>mode</parameter>
are the same as in <function>fopen</function>
(<parameter>mode</parameter> defaults to 'w'),
<parameter>connection</parameter> specifies the connection to
trace and defaults to the last one opened.
</para>
<para>
<function>pg_trace</function> returns &true; if
<parameter>pathname</parameter> could be opened for logging,
&false; otherwise.
</para>
<para>
See also <function>fopen</function> and
<function>pg_untrace</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id="function.pg-tty">
<refnamediv>
<refname>pg_tty</refname>
<refpurpose>
Return the tty name associated with the connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_tty</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_tty</function> returns the tty name that server
side debugging output is sent to on the given PostgreSQL
<parameter>connection</parameter> resource.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-tty">
<refnamediv>
<refname>pg_tty</refname>
<refpurpose>
Return the tty name associated with the connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_tty</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_tty</function> returns the tty name that server
side debugging output is sent to on the given PostgreSQL
<parameter>connection</parameter> resource.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,45 +1,45 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
<refentry id='function.pg-unescape-bytea'>
<refnamediv>
<refname>pg_unescape_bytea</refname>
<refpurpose>
Unescape binary for bytea type
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_unescape_bytea</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_unescape_bytea</function> unescapes string from
bytea datatype. It returns unescaped string (binary).
</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.
</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
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.
</para>
</note>
<para>
See also <function>pg_escape_bytea</function> and
<function>pg_escape_string</function>
</para>
</refsect1>
</refentry>
<refentry id='function.pg-unescape-bytea'>
<refnamediv>
<refname>pg_unescape_bytea</refname>
<refpurpose>
Unescape binary for bytea type
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>pg_unescape_bytea</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_unescape_bytea</function> unescapes string from
bytea datatype. It returns unescaped string (binary).
</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.
</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
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.
</para>
</note>
<para>
See also <function>pg_escape_bytea</function> and
<function>pg_escape_string</function>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,30 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 -->
<refentry id="function.pg-untrace">
<refnamediv>
<refname>pg_untrace</refname>
<refpurpose>Disable tracing of a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_untrace</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Stop tracing started by <function>pg_trace</function>.
<parameter>connection</parameter> specifies the connection that was
traced and defaults to the last one opened.
</para>
<para>
Returns always &true;.
</para>
<para>
See also <function>pg_trace</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.pg-untrace">
<refnamediv>
<refname>pg_untrace</refname>
<refpurpose>Disable tracing of a PostgreSQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pg_untrace</methodname>
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Stop tracing started by <function>pg_trace</function>.
<parameter>connection</parameter> specifies the connection that was
traced and defaults to the last one opened.
</para>
<para>
Returns always &true;.
</para>
<para>
See also <function>pg_trace</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,57 +1,57 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-update'>
<refnamediv>
<refname>pg_update</refname>
<refpurpose>
Update table
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>pg_update</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>data</parameter></methodparam>
<methodparam><type>array</type><parameter>condition</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_update</function> updates records that matches
<literal>condition</literal> with <literal>data</literal>. If
<literal>options</literal> is specified,
<function>pg_convert</function> is applied to
<literal>data</literal> with specified options.
</para>
<para>
<example>
<title><function>pg_update</function> example</title>
<programlisting role="php">
<refentry id='function.pg-update'>
<refnamediv>
<refname>pg_update</refname>
<refpurpose>
Update table
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>pg_update</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam><type>array</type><parameter>data</parameter></methodparam>
<methodparam><type>array</type><parameter>condition</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_update</function> updates records that matches
<literal>condition</literal> with <literal>data</literal>. If
<literal>options</literal> is specified,
<function>pg_convert</function> is applied to
<literal>data</literal> with specified options.
</para>
<para>
<example>
<title><function>pg_update</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$db = pg_connect('dbname=foo');
$data = array('field1'=>'AA', 'field2'=>'BB');
// This is safe, since $_POST is converted automatically
$res = pg_update($db, 'post_log', $_POST, $data);
if ($res) {
echo "Data is updated: $res\n";
} else {
echo "User must have sent wrong inputs\n";
}
$db = pg_connect('dbname=foo');
$data = array('field1'=>'AA', 'field2'=>'BB');
// This is safe, since $_POST is converted automatically
$res = pg_update($db, 'post_log', $_POST, $data);
if ($res) {
echo "Data is updated: $res\n";
} else {
echo "User must have sent wrong inputs\n";
}
?>
]]>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
&warn.experimental.func;
<para>
See also <function>pg_convert</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,254 +1,254 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.21 $ -->
<reference id="ref.pgsql">
<title>PostgreSQL Functions</title>
<titleabbrev>PostgreSQL</titleabbrev>
<!-- $Revision: 1.22 $ -->
<reference id="ref.pgsql">
<title>PostgreSQL Functions</title>
<titleabbrev>PostgreSQL</titleabbrev>
<partintro>
<section id="pgsql.intro">
&reftitle.intro;
<partintro>
<section id="pgsql.intro">
&reftitle.intro;
<para>
PostgreSQL database is Open Source product and available without
cost. Postgres, developed originally in the UC Berkeley Computer
Science Department, pioneered many of the object-relational concepts
now becoming available in some commercial databases. It provides
SQL92/SQL99 language support, transactions, referential integrity,
stored procedures and type extensibility. PostgreSQL is an open source
descendant of this original Berkeley code.
</para>
</section>
<section id="pgsql.requirements">
&reftitle.required;
<para>
To use PostgreSQL support, you need PostgreSQL 6.5 or
later, PostgreSQL 7.0 or later to enable all PostgreSQL module
features. PostgreSQL supports many character encoding including
multibyte character encoding. The current version and more
information about PostgreSQL is available at
<ulink url="&url.pgsql;">&url.pgsql;</ulink> and
<ulink url="&url.pgsql.techdocs;">&url.pgsql.techdocs;</ulink>.
</para>
</section>
&reference.pgsql.configure;
&reference.pgsql.ini;
<section id="pgsql.using">
<title>How to use and hints</title>
<warning>
<para>
PostgreSQL database is Open Source product and available without
cost. Postgres, developed originally in the UC Berkeley Computer
Science Department, pioneered many of the object-relational concepts
now becoming available in some commercial databases. It provides
SQL92/SQL99 language support, transactions, referential integrity,
stored procedures and type extensibility. PostgreSQL is an open source
descendant of this original Berkeley code.
</para>
</section>
<section id="pgsql.requirements">
&reftitle.required;
<para>
To use PostgreSQL support, you need PostgreSQL 6.5 or
later, PostgreSQL 7.0 or later to enable all PostgreSQL module
features. PostgreSQL supports many character encoding including
multibyte character encoding. The current version and more
information about PostgreSQL is available at
<ulink url="&url.pgsql;">&url.pgsql;</ulink> and
<ulink url="&url.pgsql.techdocs;">&url.pgsql.techdocs;</ulink>.
</para>
</section>
&reference.pgsql.configure;
&reference.pgsql.ini;
<section id="pgsql.using">
<title>How to use and hints</title>
<warning>
<para>
Using the PostgreSQL module with PHP 4.0.6 is not recommended due to
a bug in the notice message handling code. Use 4.1.0 or later.
</para>
</warning>
<warning>
<para>
PostgreSQL function names will be changed in 4.2.0 release to
confirm to current coding standards. Most of new names will have
additional underscores, e.g. pg_lo_open(). Some functions are
renamed to different name for consistency. e.g. pg_exec() to
pg_query(). Older names can be used in 4.2.0 and a few releases
from 4.2.0, but they may be deleted in the future.
</para>
<table>
<title>Function names changed</title>
<tgroup cols="2">
<thead>
<row>
<entry>Old name</entry>
<entry>New name</entry>
</row>
</thead>
<tbody>
<row>
<entry><function>pg_cmdtuples</function></entry>
<entry><function>pg_affected_rows</function></entry>
</row>
<row>
<entry><function>pg_errormessage</function></entry>
<entry><function>pg_last_error</function></entry>
</row>
<row>
<entry><function>pg_exec</function></entry>
<entry><function>pg_query</function></entry>
</row>
<row>
<entry><function>pg_fieldname</function></entry>
<entry><function>pg_field_name</function></entry>
</row>
<row>
<entry><function>pg_fieldsize</function></entry>
<entry><function>pg_field_size</function></entry>
</row>
<row>
<entry><function>pg_fieldnum</function></entry>
<entry><function>pg_field_num</function></entry>
</row>
<row>
<entry><function>pg_fieldprtlen</function></entry>
<entry><function>pg_field_prtlen</function></entry>
</row>
<row>
<entry><function>pg_fieldisnull</function></entry>
<entry><function>pg_field_is_null</function></entry>
</row>
<row>
<entry><function>pg_freeresult</function></entry>
<entry><function>pg_free_result</function></entry>
</row>
<row>
<entry><function>pg_getlastoid</function></entry>
<entry><function>pg_last_oid</function></entry>
</row>
<row>
<entry><function>pg_loreadall</function></entry>
<entry><function>pg_lo_read_all</function></entry>
</row>
<row>
<entry><function>pg_locreate</function></entry>
<entry><function>pg_lo_create</function></entry>
</row>
<row>
<entry><function>pg_lounlink</function></entry>
<entry><function>pg_lo_unlink</function></entry>
</row>
<row>
<entry><function>pg_loopen</function></entry>
<entry><function>pg_lo_open</function></entry>
</row>
<row>
<entry><function>pg_loclose</function></entry>
<entry><function>pg_lo_close</function></entry>
</row>
<row>
<entry><function>pg_loread</function></entry>
<entry><function>pg_lo_read</function></entry>
</row>
<row>
<entry><function>pg_lowrite</function></entry>
<entry><function>pg_lo_write</function></entry>
</row>
<row>
<entry><function>pg_loimport</function></entry>
<entry><function>pg_lo_import</function></entry>
</row>
<row>
<entry><function>pg_loexport</function></entry>
<entry><function>pg_lo_export</function></entry>
</row>
<row>
<entry><function>pg_numrows</function></entry>
<entry><function>pg_num_rows</function></entry>
</row>
<row>
<entry><function>pg_numfields</function></entry>
<entry><function>pg_num_fields</function></entry>
</row>
<row>
<entry><function>pg_result</function></entry>
<entry><function>pg_fetch_result</function></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The old <function>pg_connect</function>/<function>pg_pconnect</function>
syntax will be deprecated to support asynchronous connections in the
future. Please use a connection string for <function>pg_connect</function>
and <function>pg_pconnect</function>.
Using the PostgreSQL module with PHP 4.0.6 is not recommended due to
a bug in the notice message handling code. Use 4.1.0 or later.
</para>
</warning>
<warning>
<para>
PostgreSQL function names will be changed in 4.2.0 release to
confirm to current coding standards. Most of new names will have
additional underscores, e.g. pg_lo_open(). Some functions are
renamed to different name for consistency. e.g. pg_exec() to
pg_query(). Older names can be used in 4.2.0 and a few releases
from 4.2.0, but they may be deleted in the future.
</para>
<table>
<title>Function names changed</title>
<tgroup cols="2">
<thead>
<row>
<entry>Old name</entry>
<entry>New name</entry>
</row>
</thead>
<tbody>
<row>
<entry><function>pg_cmdtuples</function></entry>
<entry><function>pg_affected_rows</function></entry>
</row>
<row>
<entry><function>pg_errormessage</function></entry>
<entry><function>pg_last_error</function></entry>
</row>
<row>
<entry><function>pg_exec</function></entry>
<entry><function>pg_query</function></entry>
</row>
<row>
<entry><function>pg_fieldname</function></entry>
<entry><function>pg_field_name</function></entry>
</row>
<row>
<entry><function>pg_fieldsize</function></entry>
<entry><function>pg_field_size</function></entry>
</row>
<row>
<entry><function>pg_fieldnum</function></entry>
<entry><function>pg_field_num</function></entry>
</row>
<row>
<entry><function>pg_fieldprtlen</function></entry>
<entry><function>pg_field_prtlen</function></entry>
</row>
<row>
<entry><function>pg_fieldisnull</function></entry>
<entry><function>pg_field_is_null</function></entry>
</row>
<row>
<entry><function>pg_freeresult</function></entry>
<entry><function>pg_free_result</function></entry>
</row>
<row>
<entry><function>pg_getlastoid</function></entry>
<entry><function>pg_last_oid</function></entry>
</row>
<row>
<entry><function>pg_loreadall</function></entry>
<entry><function>pg_lo_read_all</function></entry>
</row>
<row>
<entry><function>pg_locreate</function></entry>
<entry><function>pg_lo_create</function></entry>
</row>
<row>
<entry><function>pg_lounlink</function></entry>
<entry><function>pg_lo_unlink</function></entry>
</row>
<row>
<entry><function>pg_loopen</function></entry>
<entry><function>pg_lo_open</function></entry>
</row>
<row>
<entry><function>pg_loclose</function></entry>
<entry><function>pg_lo_close</function></entry>
</row>
<row>
<entry><function>pg_loread</function></entry>
<entry><function>pg_lo_read</function></entry>
</row>
<row>
<entry><function>pg_lowrite</function></entry>
<entry><function>pg_lo_write</function></entry>
</row>
<row>
<entry><function>pg_loimport</function></entry>
<entry><function>pg_lo_import</function></entry>
</row>
<row>
<entry><function>pg_loexport</function></entry>
<entry><function>pg_lo_export</function></entry>
</row>
<row>
<entry><function>pg_numrows</function></entry>
<entry><function>pg_num_rows</function></entry>
</row>
<row>
<entry><function>pg_numfields</function></entry>
<entry><function>pg_num_fields</function></entry>
</row>
<row>
<entry><function>pg_result</function></entry>
<entry><function>pg_fetch_result</function></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Not all functions are supported by all builds. It depends on your
libpq (The PostgreSQL C Client interface) version and how libpq is
compiled. If there is missing function, libpq does not support
the feature required for the function.
The old <function>pg_connect</function>/<function>pg_pconnect</function>
syntax will be deprecated to support asynchronous connections in the
future. Please use a connection string for <function>pg_connect</function>
and <function>pg_pconnect</function>.
</para>
<para>
It is also important that you do not use an older libpq than the PostgreSQL
Server to which you will be connecting. If you use libpq older than PostgreSQL
Server expects, you may have problems.
</para>
<para>
Since version 6.3 (03/02/1998) PostgreSQL uses unix domain sockets
by default. TCP port will NOT be opened by default. A table is
shown below describing these new connection possibilities. This
socket will be found in <filename>/tmp/.s.PGSQL.5432</filename>.
This option can be enabled with the '-i' flag to
<command>postmaster</command> and its meaning is: "listen on
TCP/IP sockets as well as Unix domain sockets".
<table>
<title>Postmaster and PHP</title>
<tgroup cols="3">
<thead>
<row>
<entry>Postmaster</entry>
<entry>PHP</entry>
<entry>Status</entry>
</row>
</thead>
<tbody>
<row>
<entry>postmaster &amp;</entry>
<entry>pg_connect("dbname=MyDbName");</entry>
<entry>OK</entry>
</row>
<row>
<entry>postmaster -i &amp;</entry>
<entry>pg_connect("dbname=MyDbName");</entry>
<entry>OK</entry>
</row>
<row>
<entry>postmaster &amp;</entry>
<entry>pg_connect("host=localhost dbname=MyDbName");</entry>
<entry>
Unable to connect to PostgreSQL server: connectDB() failed:
Is the postmaster running and accepting TCP/IP (with -i)
connection at 'localhost' on port '5432'? in
/path/to/file.php on line 20.
</entry>
</row>
<row>
<entry>postmaster -i &amp;</entry>
<entry>pg_connect("host=localhost dbname=MyDbName");</entry>
<entry>OK</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
A connection to PostgreSQL server can be established with the
following value pairs set in the command string: <command>$conn =
pg_connect("host=myHost port=myPort tty=myTTY options=myOptions
dbname=myDB user=myUser password=myPassword ");
</command>
</para>
<para>
The previous syntax of:
<command>
$conn = pg_connect ("host", "port", "options", "tty", "dbname")
</command>
has been deprecated.
</para>
<para>
Environmental variables affect PostgreSQL server/client
behavior. For example, PostgreSQL module will lookup PGHOST
environment variable when the hostname is omitted in the connection
string. Supported environment variables are different from version
to version. Refer to PostgreSQL Programmer's Manual (libpq -
Environment Variables) for details.
</para>
<para>
Make sure you set environment variables for appropriate user. Use
<literal>$_ENV</literal> or <function>getenv</function> to check
which environment variables are available to the current process.
</para>
<example>
<title>Setting default parameters</title>
<programlisting>
</warning>
<para>
Not all functions are supported by all builds. It depends on your
libpq (The PostgreSQL C Client interface) version and how libpq is
compiled. If there is missing function, libpq does not support
the feature required for the function.
</para>
<para>
It is also important that you do not use an older libpq than the PostgreSQL
Server to which you will be connecting. If you use libpq older than PostgreSQL
Server expects, you may have problems.
</para>
<para>
Since version 6.3 (03/02/1998) PostgreSQL uses unix domain sockets
by default. TCP port will NOT be opened by default. A table is
shown below describing these new connection possibilities. This
socket will be found in <filename>/tmp/.s.PGSQL.5432</filename>.
This option can be enabled with the '-i' flag to
<command>postmaster</command> and its meaning is: "listen on
TCP/IP sockets as well as Unix domain sockets".
<table>
<title>Postmaster and PHP</title>
<tgroup cols="3">
<thead>
<row>
<entry>Postmaster</entry>
<entry>PHP</entry>
<entry>Status</entry>
</row>
</thead>
<tbody>
<row>
<entry>postmaster &amp;</entry>
<entry>pg_connect("dbname=MyDbName");</entry>
<entry>OK</entry>
</row>
<row>
<entry>postmaster -i &amp;</entry>
<entry>pg_connect("dbname=MyDbName");</entry>
<entry>OK</entry>
</row>
<row>
<entry>postmaster &amp;</entry>
<entry>pg_connect("host=localhost dbname=MyDbName");</entry>
<entry>
Unable to connect to PostgreSQL server: connectDB() failed:
Is the postmaster running and accepting TCP/IP (with -i)
connection at 'localhost' on port '5432'? in
/path/to/file.php on line 20.
</entry>
</row>
<row>
<entry>postmaster -i &amp;</entry>
<entry>pg_connect("host=localhost dbname=MyDbName");</entry>
<entry>OK</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
A connection to PostgreSQL server can be established with the
following value pairs set in the command string: <command>$conn =
pg_connect("host=myHost port=myPort tty=myTTY options=myOptions
dbname=myDB user=myUser password=myPassword ");
</command>
</para>
<para>
The previous syntax of:
<command>
$conn = pg_connect ("host", "port", "options", "tty", "dbname")
</command>
has been deprecated.
</para>
<para>
Environmental variables affect PostgreSQL server/client
behavior. For example, PostgreSQL module will lookup PGHOST
environment variable when the hostname is omitted in the connection
string. Supported environment variables are different from version
to version. Refer to PostgreSQL Programmer's Manual (libpq -
Environment Variables) for details.
</para>
<para>
Make sure you set environment variables for appropriate user. Use
<literal>$_ENV</literal> or <function>getenv</function> to check
which environment variables are available to the current process.
</para>
<example>
<title>Setting default parameters</title>
<programlisting>
<![CDATA[
PGHOST=pgsql.example.com
PGPORT=7890
@ -261,61 +261,62 @@ PGCLIENTENCODING=EUC-JP
export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD PGDATESTYLE PGTZ PGCLIENTENCODING
]]>
</programlisting>
</example>
<note>
<para>
PostgreSQL automatically folds all identifiers (e.g. table/column names)
to lower-case values. To get it to recognize upper-case values, you must
always wrap the identifier in quotes.
</para>
</note>
</section>
&reference.pgsql.constants;
<section id="pgsql.examples">
&reftitle.examples;
</programlisting>
</example>
<note>
<para>
Starting with PostgreSQL 7.1.0, you can store up to 1GB into a
field of type text. In older versions, this was limited to the block
size (default was 8KB, maximum was 32KB, defined at compile time)
PostgreSQL automatically folds all identifiers (e.g. table/column names)
to lower-case values. To get it to recognize upper-case values, you must
always wrap the identifier in quotes.
</para>
<para>
To use the large object (lo) interface, it is required to enclose
large object functions within a transaction block. A transaction
block starts with a SQL statement <command>BEGIN</command> and if
the transaction was valid ends with <command>COMMIT</command> or
<command>END</command>. If the transaction fails the transaction
should be closed with <command>ROLLBACK</command> or
<command>ABORT</command>.
<example>
<title>Using Large Objects</title>
<programlisting role="php">
</note>
</section>
&reference.pgsql.constants;
<section id="pgsql.examples">
&reftitle.examples;
<para>
Starting with PostgreSQL 7.1.0, you can store up to 1GB into a
field of type text. In older versions, this was limited to the block
size (default was 8KB, maximum was 32KB, defined at compile time)
</para>
<para>
To use the large object (lo) interface, it is required to enclose
large object functions within a transaction block. A transaction
block starts with a SQL statement <command>BEGIN</command> and if
the transaction was valid ends with <command>COMMIT</command> or
<command>END</command>. If the transaction fails the transaction
should be closed with <command>ROLLBACK</command> or
<command>ABORT</command>.
<example>
<title>Using Large Objects</title>
<programlisting role="php">
<![CDATA[
<?php
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$oid = pg_lo_create($database);
echo "$oid\n";
$handle = pg_lo_open($database, $oid, "w");
echo "$handle\n";
pg_lo_write($handle, "large object data");
pg_lo_close($handle);
pg_query($database, "commit");
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$oid = pg_lo_create($database);
echo "$oid\n";
$handle = pg_lo_open($database, $oid, "w");
echo "$handle\n";
pg_lo_write($handle, "large object data");
pg_lo_close($handle);
pg_query($database, "commit");
?>
]]>
</programlisting>
</example>
You should not close the connection to the PostgreSQL server
before closing the large object.
</para>
</section>
</partintro>
</programlisting>
</example>
You should not close the connection to the PostgreSQL server
before closing the large object.
</para>
</section>
</partintro>
&reference.pgsql.functions;
</reference>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml