(PHP 4 >= 4.2.0, PHP 5)
pg_lo_export — 将大型对象导出到文件
$oid
, string $pathname
[, resource $connection
] )
oid
参数指定了要导出的大型对象的 oid,pathname
参数则指明了文件名。成功时返回 TRUE
, 或者在失败时返回 FALSE
.
要使用大型对象(lo)接口,需要将其放置在事务块中。
Note:
本函数以前的名字为 pg_loexport()。
参见 pg_lo_import()。
connection
PostgreSQL database connection resource. When
connection
is not present, the default connection
is used. The default connection is the last connection made by
pg_connect() or pg_pconnect().
oid
The OID of the large object in the database.
pathname
The full path and file name of the file in which to write the large object on the client filesystem.
成功时返回 TRUE
, 或者在失败时返回 FALSE
.
Example #1 pg_lo_export() example
<?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");
?>