array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.pg-lo-open.php', 1 => 'pg_lo_open', ), 'up' => array ( 0 => 'ref.pgsql.php', 1 => 'Funções PostgreSQL', ), 'prev' => array ( 0 => 'function.pg-lo-import.php', 1 => 'pg_lo_import', ), 'next' => array ( 0 => 'function.pg-lo-read-all.php', 1 => 'pg_lo_read_all', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/pgsql/functions/pg-lo-open.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg_lo_open — Open a large object
pg_lo_open() opens a large object in the database and returns an PgSql\Lob instance so that it can be manipulated.
Do not close the database connection before closing the PgSql\Lob instance.
To use the large object interface, it is necessary to enclose it within a transaction block.
Nota:
This function used to be called pg_loopen().
connection
Uma instância de PgSql\Connection.
Quando o parâmetro connection
não for especificado, a conexão padrão será usada.
A conexão padrão é a última conexão feita por pg_connect()
ou pg_pconnect().
A partir do PHP 8.1.0, usar a conexão padrão tornou-se defasado.
oid
The OID of the large object in the database.
mode
Can be either "r" for read-only, "w" for write only or "rw" for read and write.
Versão | Descrição |
---|---|
8.1.0 | Returns an PgSql\Lob instance now; previously, a resource was returned. |
8.1.0 |
O parâmetro connection agora espera uma instância de PgSql\Connection;
anteriormente, um resource era esperado.
|
Exemplo #1 pg_lo_open() example
<?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");
?>