Re: How to get the size of a large object?

From: swalker <swalker(at)ct36753-a(dot)jfrvil1(dot)in(dot)home(dot)com>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get the size of a large object?
Date: 2000-04-21 20:10:11
Message-ID: Pine.LNX.4.21.0004211603570.2828-100000@ct36753-a.jfrvil1.in.home.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Culberson, Philip 2000-04-21 20:37:24 RE: COPY Question
Previous Message Robert B. Easter 2000-04-21 19:04:02 How to get the size of a large object?