Thread: Large objects

Large objects

From
Luis Martins
Date:
 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.

  Luis

-- 
__________________________
    Luis Martins
Eng. Sistemas e Computacao
 UCEH - Univ. do Algarve
__________________________
  email : kalium@usa.net
__________________________
 

Re: Large objects

From
Tatsuo Ishii
Date:
>  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