This really doesn't answer your question.  But maybe it will achieve the
same result.

PHP has a function called pg_loreadall.  This function reads a large
object and passes it straight through to the browser. 

Here is an example
<?
        $db = pg_connect("your connect string");
        pg_exec($db, "begin");
        $result = pg_exec($db, "select image_oid,
                                       image_header 
                                  from image_mstr 
                                 where image_id = 1");
        $row = pg_fetch_row($result, 0);
        pg_exec($db, "end");
        $image_oid = $row[0];
        $header = $row[1];
        pg_exec($db, "begin");
        $fh = pg_loopen($db, $image_oid, "r");
        Header($header);
        pg_loreadall($fh);
        pg_loclose($fh);
        pg_exec($db, "end");
        pg_close($db);
?>

On Fri, 21 Apr 2000, Robert B. Easter wrote:

> I use php4 and I'm wondering if there is a way to find out the size of a large
> object so that when I call pg_loread($fd, $len), I can set $len to the correct
> number of bytes to read in.  Does the database maintain this information
> anywhere accessible by a query?  I could store the sizes in a table along with
> the oids but would rather not if I don't need to.
> 

Reply via email to