Re: Question re large objects

Поиск
Список
Период
Сортировка
От Stephen van Egmond
Тема Re: Question re large objects
Дата
Msg-id 20001128132923.B30495@bang.dhs.org
обсуждение исходный текст
Ответ на Question re large objects  (chriswood@wvda.com)
Список pgsql-php
chriswood@wvda.com (chriswood@wvda.com) wrote:
> I've considered the alternatives (store files in a directory or in the
> db), and I think storing the image files in the database is the way to
> go. Unless anybody can think of why I should just upload the files
> to a directory on the server instead of storing them as BLOBs.

Because you will lose the images when you do a restore from backup.
And you will have to restore from backup eventually, count on it.

On the other hand, if your service will ever grow to more than one
computer doing HTTP service (i.e. load balancing), you will have to
have the items in the database or resort to unsightly things like NFS.

If you expect your site to get big or be busy, you will have to come up
with a way (preferably an abstraction on top of pg_lo* functions) that
will preserve the BLOBs in the database so that when you do a reload,
you can pump in the BLOBs as well and connect their *new* OIDs with the
appropriate table.  Because the OIDs will change when you reload.

You do have a backup plan, right?

> plunks itself into my test page as text/plain. How do I get a mime
> type header associated with this data so my browser will recognize
> it as a gif or jpeg?

Store the content type in the database along with the file data. When
you pull it out, use:

        header("Content-type: $mime");

       ,,,
      (. .)
+--ooO-(_)-Ooo------------ --- -- - - -  -
| Stephen van Egmond  http://bang.dhs.org/



В списке pgsql-php по дате отправления:

Предыдущее
От: "Mitch Vincent"
Дата:
Сообщение: Re: Question re large objects
Следующее
От: chriswood@wvda.com
Дата:
Сообщение: Re: Question re large objects