<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >PDO::pgsqlLOBOpen</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="PostgreSQL Functions (PDO_PGSQL)" HREF="ref.pdo-pgsql.html"><LINK REL="PREVIOUS" TITLE="PDO::pgsqlLOBCreate" HREF="function.pdo-pgsqllobcreate.html"><LINK REL="NEXT" TITLE="PDO::pgsqlLOBUnlink" HREF="function.pdo-pgsqllobunlink.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.pdo-pgsqllobcreate.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.pdo-pgsqllobunlink.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.PDO-pgsqlLOBOpen" ></A >PDO::pgsqlLOBOpen</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN183264" ></A ><P > (no version information, might be only in CVS)</P >PDO::pgsqlLOBOpen -- Opens an existing large object stream</DIV ><DIV CLASS="refsect1" ><A NAME="AEN183267" ></A ><H2 >Descrição</H2 >resource <B CLASS="methodname" >PDO::pgsqlLOBOpen</B > ( string oid [, string mode] )<BR ></BR ><P > <B CLASS="function" >PDO::pgsqlLOBOpen()</B > opens a stream to access the data referenced by <CODE CLASS="parameter" >oid</CODE >. If <CODE CLASS="parameter" >mode</CODE > is <TT CLASS="literal" >r</TT >, the stream is opened for reading, if <CODE CLASS="parameter" >mode</CODE > is <TT CLASS="literal" >w</TT >, then the stream will be opened for writing. You can use all the usual filesystem functions, such as <A HREF="function.fread.html" ><B CLASS="function" >fread()</B ></A >, <A HREF="function.fwrite.html" ><B CLASS="function" >fwrite()</B ></A > and <A HREF="function.fgets.html" ><B CLASS="function" >fgets()</B ></A > to manipulate the contents of the stream. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > This function, and all manipulations of the large object, must be called and carried out within a transaction. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN183290" ></A ><H2 >Parâmetros</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >oid</CODE ></DT ><DD ><P > A large object identifier. </P ></DD ><DT ><CODE CLASS="parameter" >mode</CODE ></DT ><DD ><P > If mode is <TT CLASS="literal" >r</TT >, open the stream for reading. If mode is <TT CLASS="literal" >w</TT >, open the stream for writing. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN183306" ></A ><H2 >Valores de retornado</H2 ><P > Returns a stream resource on success, or <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN183310" ></A ><H2 >Exemplos</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN183313" ></A ><P ><B >Exemplo 1. A <B CLASS="function" >PDO::pgsqlLOBOpen()</B > example</B ></P ><P > Following on from the <B CLASS="function" >PDO::pgsqlLOBCreate()</B > example, this code snippet retrieves the large object from the database and outputs it to the browser. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$db </font><font color="#007700">= new </font><font color="#0000BB">PDO</font><font color="#007700">(</font><font color="#DD0000">'pgsql:dbname=test host=localhost'</font><font color="#007700">, </font><font color="#0000BB">$user</font><font color="#007700">, </font><font color="#0000BB">$pass</font><font color="#007700">);<br /></font><font color="#0000BB">$db</font><font color="#007700">-></font><font color="#0000BB">setAttribute</font><font color="#007700">(</font><font color="#0000BB">PDO</font><font color="#007700">::</font><font color="#0000BB">ATTR_ERRMODE</font><font color="#007700">, </font><font color="#0000BB">PDO</font><font color="#007700">::</font><font color="#0000BB">ERRMODE_EXCEPTION</font><font color="#007700">);<br /></font><font color="#0000BB">$db</font><font color="#007700">-></font><font color="#0000BB">beginTransaction</font><font color="#007700">();<br /></font><font color="#0000BB">$stmt </font><font color="#007700">= </font><font color="#0000BB">$db</font><font color="#007700">-></font><font color="#0000BB">prepare</font><font color="#007700">(</font><font color="#DD0000">"select oid from BLOBS where ident = ?"</font><font color="#007700">);<br /></font><font color="#0000BB">$stmt</font><font color="#007700">-></font><font color="#0000BB">execute</font><font color="#007700">(array(</font><font color="#0000BB">$some_id</font><font color="#007700">));<br /></font><font color="#0000BB">$stmt</font><font color="#007700">-></font><font color="#0000BB">bindColumn</font><font color="#007700">(</font><font color="#DD0000">'oid'</font><font color="#007700">, </font><font color="#0000BB">$lob</font><font color="#007700">, </font><font color="#0000BB">PDO</font><font color="#007700">::</font><font color="#0000BB">PARAM_LOB</font><font color="#007700">);<br /></font><font color="#0000BB">$stmt</font><font color="#007700">-></font><font color="#0000BB">fetch</font><font color="#007700">(</font><font color="#0000BB">PDO</font><font color="#007700">::</font><font color="#0000BB">FETCH_BOUND</font><font color="#007700">);<br /></font><font color="#0000BB">fpassthru</font><font color="#007700">(</font><font color="#0000BB">$lob</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN183319" ></A ><H2 >Veja também</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><B CLASS="function" >PDO::pgsqlLOBCreate()</B ></TD ></TR ><TR ><TD ><B CLASS="function" >PDO::pgsqlLOBUnlink()</B ></TD ></TR ><TR ><TD ><A HREF="function.pg-lo-open.html" ><B CLASS="function" >pg_lo_open()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.pdo-pgsqllobcreate.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.pdo-pgsqllobunlink.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >PDO::pgsqlLOBCreate</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.pdo-pgsql.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >PDO::pgsqlLOBUnlink</TD ></TR ></TABLE ></DIV ></BODY ></HTML >