Re: Large objects - Mailing list pgsql-general

From Tatsuo Ishii
Subject Re: Large objects
Date
Msg-id 20000615145339X.t-ishii@sra.co.jp
Whole thread Raw
In response to Large objects  (Luis Martins <kalium@usa.net>)
List pgsql-general
>  Hi everyone, I have to insert a few PDF files into my database, and I
> am not able to do it ...
>   I have to use PHP3, and all I could do was use the lo_import, but in
> this case, I am not able to insert any data because I am not an
> administrator. Is there any other way of doing it, using, let's say,
> pg_locreate, pg_loopen, or something like that ?
>   Thanx in advance.

Of course you can. The essential part of the program should look like:

  pg_exec($con,"begin");
  $oid = pg_locreate($con);
  $lobj = pg_loopen($con,$oid,"w");
  /* read your PDF file contents into $img variable */
  pg_lowrite($lobj,$img);
  pg_loclose($lobj);
  pg_exec($con,"end");
--
Tatsuo Ishii

pgsql-general by date:

Previous
From: Marc Britten
Date:
Subject: trigger errors
Next
From: Paulo Jan
Date:
Subject: Re: "Tuple is too big"