Re: storing files in postgres

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bob Powell <bob(at)hotchkiss(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: storing files in postgres
Date: 2005-03-31 17:44:07
Message-ID: 1112291047.30190.4.camel@jd2.commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2005-03-31 at 12:03 -0500, Bob Powell wrote:
> -->
> Hello everyone,
>
> I have created a table as follows:
>
> CREATE TABLE document (
> image_id int,
> image bytea
> );
>
> I want to insert a complete file, let's say an open office document
> into this table. Anyone know how I would doe this?

You need to use the bytea functions allocated to your language API.
Which language are you using for this?

>
> Then if I can get the document into the image field, how would I
> retrieve it to display it in my HTML document?

When you say "display" what do you mean? An open office sxw document
is not going to display in an html document. You can link to it or
have it stream to launch an external application though.

Sincerely,

Joshua D. Drake

>
> Thanks in advance.
>
> Bob Powell
> Database Administrator
>
--
Command Prompt, Inc., Your PostgreSQL solutions company. 503-667-4564
Custom programming, 24x7 support, managed services, and hosting
Open Source Authors: plPHP, pgManage, Co-Authors: plPerlNG
Reliable replication, Mammoth Replicator - http://www.commandprompt.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Julian Scarfe 2005-03-31 17:52:28 Re: truncate/create slowness
Previous Message Bruno Wolff III 2005-03-31 17:22:18 Re: Days in month query