From: | Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Saving a jpg into Postgresql table |
Date: | 2006-08-25 20:49:25 |
Message-ID: | 20060825204925.GS6550@merkur.hilbert.loc |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Aug 25, 2006 at 10:17:34AM -0700, Jeff Davis wrote:
> > It takes aproximately 25-30% more disk space but is much easier for me
> > to operate with it.
> > When I read the object from the database I decode it and I have the file
> > in the original format.
>
> Why not go a step further and do this:
>
> (1) encode the image as base64
> (2) insert into mytable(image) values(decode('<base64 encoding of
> image>','base64'));
>
> Then, to get it back:
>
> (1) select encode(image,'base64') from mytable;
> (2) decode the base64 into your image
Should that jumping through the base64 loops even be
necessary ? I thought that I could just send the raw data
when it ends up in a bytea field. However, your advice and
previous suggestions make me have a sneaking suspicion that
it still depends on how my PG library puts the data on the
wire:
a) as a string inside the query itself (in which case it
should not be touched by encoding conversions as its headed
towards a bytea field but still needs to be quoted properly
which, again, the library should do)
b) in raw binary if bound parameters are used (values
transmitted separate from the query)
Am I correct ?
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Shellam | 2006-08-25 21:01:30 | Re: CMS - portal server Question |
Previous Message | Marc Munro | 2006-08-25 20:12:22 | Re: Something blocking in libpq_gettext? |