mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Continue revising pgsql docs. Still a long way to go...
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183850 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
b1f16681e1
commit
6ccf606963
13 changed files with 660 additions and 68 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-fetch-object">
|
||||
<refnamediv>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
The name of the class to instantiate, set the properties of and return.
|
||||
If not specified, an unnamed object is returned.
|
||||
If not specified, an <literal>stdClass</literal> object is returned.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?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-is-null">
|
||||
<refnamediv>
|
||||
<refname>pg_field_is_null</refname>
|
||||
<refpurpose>Test if a field is &null;</refpurpose>
|
||||
<refpurpose>Test if a field is SQL <literal>NULL</literal></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
|
@ -12,15 +12,12 @@
|
|||
<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 choice="opt"><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.
|
||||
<function>pg_field_is_null</function> tests if a field in a PostgreSQL
|
||||
result resource is SQL <literal>NULL</literal> or not.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -29,6 +26,50 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
|
||||
current row is fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Field number (starting from 0) as an <type>integer</type> or
|
||||
the field name as a <type>string</type>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns <literal>1</literal> if the field in the given row is SQL <literal>NULL</literal>, <literal>0</literal>
|
||||
if not. &false; is returned if the row is out of range, or upon any other error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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-field-name">
|
||||
<refnamediv>
|
||||
|
@ -27,6 +27,39 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field_number</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Field number, starting from 0.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The field name, or &false; on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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-num">
|
||||
<refnamediv>
|
||||
|
@ -16,13 +16,9 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_field_num</function> will return the number of the
|
||||
column (field) slot that corresponds to the
|
||||
field number 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.
|
||||
<parameter>result</parameter> resource.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -31,6 +27,65 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field_name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the field.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The field number (numbered from 0), or -1 on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Getting information about fields</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
|
||||
|
||||
$res = pg_query($dbconn, "select author, year, title from authors where author = 'Orwell'");
|
||||
|
||||
echo "Column 'title' is field number: ", pg_field_num($res, 'title');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Column 'title' is field number: 2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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-prtlen">
|
||||
<refnamediv>
|
||||
|
@ -37,6 +37,40 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row number in result. Rows are numbered from 0 upwards. If omitted,
|
||||
current row is fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The field name, or &false; on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-field-size">
|
||||
<refnamediv>
|
||||
|
@ -19,12 +19,7 @@
|
|||
<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.
|
||||
<parameter>result</parameter>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -33,6 +28,89 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field_number</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Field number, starting from 0.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The internal field storage size (in bytes). -1 indicates a variable
|
||||
length field. &false; is returned on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Getting information about fields</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'");
|
||||
$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>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
column 0
|
||||
fieldname: author
|
||||
printed length: 6 characters
|
||||
storage length: -1 bytes
|
||||
field type: varchar
|
||||
|
||||
column 1
|
||||
fieldname: year
|
||||
printed length: 4 characters
|
||||
storage length: 2 bytes
|
||||
field type: int2
|
||||
|
||||
column 2
|
||||
fieldname: title
|
||||
printed length: 24 characters
|
||||
storage length: -1 bytes
|
||||
field type: varchar
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<refentry id="function.pg-field-type-oid">
|
||||
<refnamediv>
|
||||
<refname>pg_field_type_oid</refname>
|
||||
|
@ -17,16 +17,84 @@
|
|||
</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.
|
||||
OID of the base type of the given <parameter>field_number</parameter> in the
|
||||
given PostgreSQL <parameter>result</parameter> resource.
|
||||
</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.
|
||||
You can get more information about the field type by querying PostgreSQL's
|
||||
<literal>pg_type</literal> system table using the OID obtained with this function.
|
||||
The PostgreSQL <literal>format_type()</literal> function will convert a
|
||||
type OID into an SQL standard type name.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
If the field uses a PostgreSQL domain (rather than a basic type), it is
|
||||
the OID of the domain's underlying type that is returned, rather than the OID
|
||||
of the domain itself.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field_number</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Field number, starting from 0.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The OID of the field's base type. &false; is returned on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Getting information about fields</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
|
||||
|
||||
// Assume 'title' is a varchar type
|
||||
$res = pg_query($dbconn, "select title from authors where author = 'Orwell'");
|
||||
|
||||
echo "Title field type OID: ", pg_field_type_oid($res, 0);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Title field type OID: 1043
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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.52 -->
|
||||
<refentry id="function.pg-field-type">
|
||||
<refnamediv>
|
||||
|
@ -18,13 +18,16 @@
|
|||
</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.
|
||||
base type name of the given <parameter>field_number</parameter> in the
|
||||
given PostgreSQL <parameter>result</parameter> resource.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
If the field uses a PostgreSQL domain (rather than a basic type), it is
|
||||
the name of the domain's underlying type that is returned, rather than the
|
||||
name of the domain itself.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
This function used to be called <literal>pg_fieldtype()</literal>.
|
||||
|
@ -32,6 +35,67 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field_number</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Field number, starting from 0.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
A <type>string</type> containing the base name of the field's type, or &false;
|
||||
on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Getting information about fields</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
|
||||
|
||||
// Assume 'title' is a varchar type
|
||||
$res = pg_query($dbconn, "select title from authors where author = 'Orwell'");
|
||||
|
||||
echo "Title field type: ", pg_field_type($res, 0);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Title field type: varchar
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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-close">
|
||||
<refnamediv>
|
||||
|
@ -14,12 +14,12 @@
|
|||
<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
|
||||
<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
|
||||
To use the large object interface, it is necessary to
|
||||
enclose it within a transaction block.
|
||||
</para>
|
||||
<note>
|
||||
|
@ -29,6 +29,53 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL large object (LOB) resource, returned by <function>pg_lo_open</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_lo_close</function> example</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");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-lo-create">
|
||||
<refnamediv>
|
||||
|
@ -14,27 +14,80 @@
|
|||
<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
|
||||
<function>pg_lo_create</function> creates a large
|
||||
object and returns the <varname>OID</varname> of the large
|
||||
object. PostgreSQL access modes
|
||||
<constant>INV_READ</constant>, <constant>INV_WRITE</constant>, and
|
||||
<constant>INV_ARCHIVE</constant> 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.
|
||||
access. <constant>INV_ARCHIVE</constant> has been removed from PostgreSQL itself
|
||||
(version 6.3 and above).
|
||||
</para>
|
||||
<para>
|
||||
To use the large object (lo) interface, it is necessary to
|
||||
To use the large object interface, it is necessary to
|
||||
enclose it within a transaction block.
|
||||
</para>
|
||||
<para>
|
||||
Instead of using the large object interface (which has no access controls
|
||||
and is cumbersome to use), try PostgreSQL's <varname>bytea</varname>
|
||||
column type and <function>pg_escape_bytea</function>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This function used to be called <literal>pg_locreate()</literal>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>connection</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL database connection resource. When
|
||||
<parameter>connection</parameter> is not present, the default connection
|
||||
is used. The default connection is the last connection made by
|
||||
<function>pg_connect</function> or <function>pg_pconnect</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
A large object <varname>OID</varname> or &false; on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_lo_create</function> example</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");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.6 -->
|
||||
<refentry id="function.pg-lo-export">
|
||||
<refnamediv>
|
||||
|
@ -21,13 +21,12 @@
|
|||
<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.
|
||||
<function>pg_lo_export</function> takes a large object in a
|
||||
PostgreSQL database and saves its contents to a file on the local
|
||||
filesystem.
|
||||
</para>
|
||||
<para>
|
||||
To use the large object (lo) interface, it is necessary to
|
||||
To use the large object interface, it is necessary to
|
||||
enclose it within a transaction block.
|
||||
</para>
|
||||
<note>
|
||||
|
@ -37,6 +36,72 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>connection</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL database connection resource. When
|
||||
<parameter>connection</parameter> is not present, the default connection
|
||||
is used. The default connection is the last connection made by
|
||||
<function>pg_connect</function> or <function>pg_pconnect</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>oid</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <varname>OID</varname> of the large object in the database.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>pathname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The full path and file name of the file in which to write the
|
||||
large object on the client filesystem.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_lo_export</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$database = pg_connect("dbname=jacarta");
|
||||
pg_query($database, "begin");
|
||||
$oid = pg_lo_create($database);
|
||||
$handle = pg_lo_open($database, $oid, "w");
|
||||
pg_lo_write($handle, "large object data");
|
||||
pg_lo_close($handle);
|
||||
pg_lo_export($database, $oid, '/tmp/lob.dat');
|
||||
pg_query($database, "commit");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.6 -->
|
||||
<refentry id="function.pg-lo-import">
|
||||
<refnamediv>
|
||||
|
@ -28,13 +28,12 @@
|
|||
<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.
|
||||
<function>pg_lo_import</function> creates a new large object
|
||||
in the database using a file on the filesystem as its data
|
||||
source.
|
||||
</para>
|
||||
<para>
|
||||
To use the large object (lo) interface, it is necessary to
|
||||
To use the large object interface, it is necessary to
|
||||
enclose it within a transaction block.
|
||||
</para>
|
||||
¬e.sm.uidcheck;
|
||||
|
@ -45,6 +44,61 @@
|
|||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>connection</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL database connection resource. When
|
||||
<parameter>connection</parameter> is not present, the default connection
|
||||
is used. The default connection is the last connection made by
|
||||
<function>pg_connect</function> or <function>pg_pconnect</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>pathname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The full path and file name of the file on the client
|
||||
filesystem from which to read the large object data.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The <varname>OID</varname> of the newly created large object, or
|
||||
&false; on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_lo_import</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$database = pg_connect("dbname=jacarta");
|
||||
pg_query($database, "begin");
|
||||
$oid = pg_lo_import($database, '/tmp/lob.dat');
|
||||
pg_query($database, "commit");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.24 $ -->
|
||||
<!-- $Revision: 1.25 $ -->
|
||||
<reference id="ref.pgsql">
|
||||
<title>PostgreSQL Functions</title>
|
||||
<titleabbrev>PostgreSQL</titleabbrev>
|
||||
|
@ -27,7 +27,7 @@
|
|||
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>.
|
||||
the <ulink url="&url.pgsql.manual;">PostgreSQL Documentation</ulink>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
|
Loading…
Reference in a new issue