php-doc-en/reference/pdo_pgsql/functions/PDO-pgsqlLOBOpen.xml
Hannes Magnusson c030e2adf7 Upgrade to DocBook5:
- All id attributes are now xml:id
 - Add docbook namespace to all root elements
 - Replace <ulink /> with <link xlink:href />
 - Minor markup fixes here and there


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238160 c90b9560-bf6c-de11-be94-00142212c4b1
2007-06-20 22:25:43 +00:00

125 lines
3.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry xml:id="function.PDO-pgsqlLOBOpen" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>PDO::pgsqlLOBOpen</refname>
<refpurpose>Opens an existing large object stream</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>PDO::pgsqlLOBOpen</methodname>
<methodparam><type>string</type><parameter>oid</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>PDO::pgsqlLOBOpen</function> opens a stream to access the data
referenced by <parameter>oid</parameter>. If <parameter>mode</parameter>
is <literal>r</literal>, the stream is opened for reading, if
<parameter>mode</parameter> is <literal>w</literal>, then the stream will
be opened for writing. You can use all the usual filesystem functions,
such as <function>fread</function>, <function>fwrite</function> and
<function>fgets</function> to manipulate the contents of the stream.
</para>
<note>
<simpara>
This function, and all manipulations of the large object,
must be called and carried out within a transaction.
</simpara>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>oid</parameter></term>
<listitem>
<para>
A large object identifier.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
If mode is <literal>r</literal>, open the stream for reading.
If mode is <literal>w</literal>, open the stream for writing.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a stream resource on success, or &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>PDO::pgsqlLOBOpen</function> example</title>
<para>
Following on from the <function>PDO::pgsqlLOBCreate</function>
example, this code snippet retrieves the large object from
the database and outputs it to the browser.
</para>
<programlisting role="php">
<![CDATA[
<?php
$db = new PDO('pgsql:dbname=test host=localhost', $user, $pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->beginTransaction();
$stmt = $db->prepare("select oid from BLOBS where ident = ?");
$stmt->execute(array($some_id));
$stmt->bindColumn('oid', $lob, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
fpassthru($lob);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>PDO::pgsqlLOBCreate</function></member>
<member><function>PDO::pgsqlLOBUnlink</function></member>
<member><function>pg_lo_open</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->