Re: FW: How to store binaries and ASCII files in DB

From: Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com>
To: Weber Matthias <weber(at)faps(dot)uni-erlangen(dot)de>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: FW: How to store binaries and ASCII files in DB
Date: 2005-06-15 10:57:48
Message-ID: 7104a737050615035763124eb9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Hi,

On 6/15/05, Weber Matthias <weber(at)faps(dot)uni-erlangen(dot)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.

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Pawel Bernat 2005-06-15 13:00:22 Re: FW: How to store binaries and ASCII files in DB
Previous Message Weber Matthias 2005-06-15 10:42:28 FW: How to store binaries and ASCII files in DB