From: Kenneth Gonsalves <lawgon@thenilgiris.com>
To: sreejith s <getsreejith@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Image Insert Postgresql DB
Date: Tue, 23 Nov 2004 10:48:44 +0530
Message-ID: <0411231048440L.01150@thenilgiris.com> (raw)
In-Reply-To: <5d14ecf904112220214ec08992@mail.gmail.com>
References: <5d14ecf904112220214ec08992@mail.gmail.com>
On Tuesday 23 November 2004 09:51 am, sreejith s wrote:
> Query to insert
> ----------------
> INSERT INTO Imagetable VALUES (lo_import('C:\\image\\peach.jpg'));
have you succeeded in inserting an image into the database from a file on the
server using the above query? AFAIK you need a bytea datatype, and also the
image data has to be properly escaped (\\) before pg will accept it. I assume
you are using a scripting language with a dbapi. Your steps would be:
1. read the image file into a variable
2. escape the image data
3. insert this into the database in a bytea field
if you follow this procedure it is irrelevant as to where the source file is
- client or server
regards
kg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: lawgon@thenilgiris.com, getsreejith@gmail.com
Subject: Re: Image Insert Postgresql DB
In-Reply-To: <0411231048440L.01150@thenilgiris.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox