Re: binary data storage

From: Doug McNaught <doug(at)wireboard(dot)com>
To: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
Cc: Denis Gasparin <denis(at)edistar(dot)com>, PostgreSQL Mailing Lists-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: binary data storage
Date: 2002-04-06 00:11:25
Message-ID: m38z81znwy.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)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...

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ed Loehr 2002-04-06 00:27:47 7.1.2 clients + 7.2.1 server?
Previous Message Tom Lane 2002-04-06 00:01:10 Re: Row locking inside a rule, is it possible?