Re: binary data storage - Mailing list pgsql-general

From Doug McNaught
Subject Re: binary data storage
Date
Msg-id m38z81znwy.fsf@varsoon.wireboard.com
Whole thread Raw
In response to Re: binary data storage  (Devrim GUNDUZ <devrim@oper.metu.edu.tr>)
List pgsql-general
Martín Marqués <martin@bugs.unl.edu.ar> writes:

> Now, I want to do an insert of a row, in which I add data to all the columns
> except the oid column, in which I want to insert a file. How do I make the
> insert with PHP, in a way that the info of row and the file loaded
> in the oid column are really in the same row.

OK, here's pseudocode.  Assuming PHP has a an interface to the lo_
routines, you'd do something like this:

BEGIN WORK;
$file_oid = lo_import("myfile");
INSERT INTO mytable(field1, field2, file_oid) VALUES ('foo', 'bar', $file_oid);
COMMIT WORK;

Does this help?

-Doug
--
Doug McNaught       Wireboard Industries      http://www.wireboard.com/

      Custom software development, systems and network consulting.
      Java PostgreSQL Enhydra Python Zope Perl Apache Linux BSD...

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Row locking inside a rule, is it possible?
Next
From: Ed Loehr
Date:
Subject: 7.1.2 clients + 7.2.1 server?