Re: How to get the size of a large object? - Mailing list pgsql-general

From swalker
Subject Re: How to get the size of a large object?
Date
Msg-id Pine.LNX.4.21.0004211603570.2828-100000@ct36753-a.jfrvil1.in.home.com
Whole thread Raw
In response to How to get the size of a large object?  ("Robert B. Easter" <reaster@comptechnews.com>)
List pgsql-general
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.
>


pgsql-general by date:

Previous
From: "Robert B. Easter"
Date:
Subject: How to get the size of a large object?
Next
From: "Culberson, Philip"
Date:
Subject: RE: COPY Question