From: Volkan YAZICI <volkan.yazici@gmail.com>
To: Weber Matthias <weber@faps.uni-erlangen.de>
Cc: pgsql-php@postgresql.org
Subject: Re: FW: How to store binaries and ASCII files in DB
Date: Wed, 15 Jun 2005 13:57:48 +0300
Message-ID: <7104a737050615035763124eb9@mail.gmail.com> (raw)
In-Reply-To: <09766A6E64A068419B362367800D50C0B58C17@moritz.faps.uni-erlangen.de>
References: <09766A6E64A068419B362367800D50C0B58C17@moritz.faps.uni-erlangen.de>
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.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: volkan.yazici@gmail.com, weber@faps.uni-erlangen.de
Subject: Re: FW: How to store binaries and ASCII files in DB
In-Reply-To: <7104a737050615035763124eb9@mail.gmail.com>
References: <09766A6E64A068419B362367800D50C0B58C17@moritz.faps.uni-erlangen.de> <7104a737050615035763124eb9@mail.gmail.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