-
Notifications
You must be signed in to change notification settings - Fork 865
Expand file tree
/
Copy pathlobopen.xml
More file actions
115 lines (109 loc) · 3.64 KB
/
lobopen.xml
File metadata and controls
115 lines (109 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="pdo-pgsql.lobopen" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>Pdo\Pgsql::lobOpen</refname>
<refpurpose>Opens an existing large object stream</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="Pdo\\Pgsql">
<modifier>public</modifier> <type class="union"><type>resource</type><type>false</type></type><methodname>Pdo\Pgsql::lobOpen</methodname>
<methodparam><type>string</type><parameter>oid</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>mode</parameter><initializer>"rb"</initializer></methodparam>
</methodsynopsis>
<simpara>
<methodname>Pdo\Pgsql::lobOpen</methodname> opens a stream to access
the data referenced by <parameter>oid</parameter>.
All usual filesystem functions, such as <function>fread</function>,
<function>fwrite</function> or <function>fgets</function> can be used
to manipulate the contents of the stream.
</simpara>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('pdo-pgsql.lobcreate')/db:refsect1[@role='description']/db:note/.)">
<xi:fallback/>
</xi:include>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>oid</parameter></term>
<listitem>
<simpara>
A large object identifier.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<simpara>
If mode is <literal>r</literal>, open the stream for reading.
If mode is <literal>w</literal>, open the stream for writing.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns a stream resource on success,&return.falseforfailure;.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="pdo-pgsql.lobopen.example.basic">
<title><methodname>Pdo\Pgsql::lobOpen</methodname> example</title>
<simpara>
Following on from the <methodname>Pdo\Pgsql::lobCreate</methodname>
example, this code snippet retrieves the large object from
the database and outputs it to the browser.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
$db = new Pdo\Pgsql('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', $oid, PDO::PARAM_STR);
$stmt->fetch(PDO::FETCH_BOUND);
$stream = $db->pgsqlLOBOpen($oid, 'r');
header("Content-type: application/octet-stream");
fpassthru($stream);
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Pdo\Pgsql::lobCreate</methodname></member>
<member><methodname>Pdo\Pgsql::lobUnlink</methodname></member>
<member><function>pg_lo_create</function></member>
<member><function>pg_lo_open</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->