pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedFW: How to store binaries and ASCII files in DB
3+ messages / 3 participants
[nested] [flat]
* FW: How to store binaries and ASCII files in DB
@ 2005-06-15 10:42 Weber Matthias <weber@faps.uni-erlangen.de>
2005-06-15 10:57 ` Re: FW: How to store binaries and ASCII files in DB Volkan YAZICI <volkan.yazici@gmail.com>
2005-06-15 13:00 ` Re: FW: How to store binaries and ASCII files in DB Pawel Bernat <asm@vlo.olsztyn.pl>
0 siblings, 2 replies; 3+ messages in thread
From: Weber Matthias @ 2005-06-15 10:42 UTC (permalink / raw)
To: pgsql-php
Hi,
is their any php code example on how to store files (binary and ASCII) into a postgres db?
Thanks,
Matthias
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: FW: How to store binaries and ASCII files in DB
2005-06-15 10:42 FW: How to store binaries and ASCII files in DB Weber Matthias <weber@faps.uni-erlangen.de>
@ 2005-06-15 10:57 ` Volkan YAZICI <volkan.yazici@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Volkan YAZICI @ 2005-06-15 10:57 UTC (permalink / raw)
To: Weber Matthias <weber@faps.uni-erlangen.de>; +Cc: pgsql-php
Hi,
On 6/15/05, Weber Matthias <weber@faps.uni-erlangen.de> wrote:
> is their any php code example on how to store files (binary and
> ASCII) into a postgres db?
There's not so much difference between a data INSERT and file storage.
But, as a first step, you should decide on the way you want to store
the related data. Will it be stored on a normal table row (in a bytea
field) or as a large object? If you'll use LO, then you should refer
to its documentation for related functions and examples. But if you'll
use a normal bytea column, I'd strongly encourage you to use
parameters while inserting data. This is going to save you from CPU
and RAM wasting escaping routines, plus SQL-Injection attacks. (For
further performance tweaks, you can use binary mode while transmitting
data.)
Regards.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: FW: How to store binaries and ASCII files in DB
2005-06-15 10:42 FW: How to store binaries and ASCII files in DB Weber Matthias <weber@faps.uni-erlangen.de>
@ 2005-06-15 13:00 ` Pawel Bernat <asm@vlo.olsztyn.pl>
1 sibling, 0 replies; 3+ messages in thread
From: Pawel Bernat @ 2005-06-15 13:00 UTC (permalink / raw)
To: pgsql-php
On Wed, Jun 15, 2005 at 12:42:28PM +0200, Weber Matthias wrote:
> is their any php code example on how to store files (binary and ASCII) into a postgres db?
http://www.php.net/manual/en/function.file-get-contents.php
http://www.php.net/manual/en/function.pg-escape-bytea.php
http://www.php.net/manual/en/function.pg-escape-string.php
http://www.php.net/manual/en/function.pg-query.php
p.
--
Paweł Bernat; uselessness' lover;
select'<asm'||chr(64)||'asm'||'.'||'flynet'||chr(46)||'pl>'as email;
Slowly and surely the unix crept up on the Nintendo user ...
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-06-15 13:00 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-15 10:42 FW: How to store binaries and ASCII files in DB Weber Matthias <weber@faps.uni-erlangen.de>
2005-06-15 10:57 ` Volkan YAZICI <volkan.yazici@gmail.com>
2005-06-15 13:00 ` Pawel Bernat <asm@vlo.olsztyn.pl>
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