Re: PHP array to PlPgSQL arrat. How to?

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: PHP array to PlPgSQL arrat. How to?
Дата
Msg-id 4D72BCE4.7010201@hogranch.com
обсуждение исходный текст
Ответ на PHP array to PlPgSQL arrat. How to?  (Andre Lopes <lopes80andre@gmail.com>)
Ответы Re: PHP array to PlPgSQL arrat. How to?  (Andre Lopes <lopes80andre@gmail.com>)
Список pgsql-general
On 03/05/11 11:22 AM, Andre Lopes wrote:
> Hi,
>
> I need to transform an PHP array to an PlPgSQL array. The PHP array is
> like this:

in a relational database, it would be far better to store that sort of
thing as a table, so you can use relational operations on it.

your example structure would fit nicely into a table like...

CREATE TABLE images (
     id integer primary key,
     base64 text,
     image_type text,
     width integer,
     height integer,
     mime text );

and use a view to construct the html_width_height value as it contains
redundant data

CREATE VIEW images_html (id, html_width_height)
     as select id, 'width="'||cast(width as text)||'"
height="'||cast(height as text)||'"' from images;




btw, if that base64 field is in fact the binary image, I would instead
change that to `image bytea` and store the image in binary.




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

Предыдущее
От: Allan Kamau
Дата:
Сообщение: Re: Why count(*) doest use index?
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Why count(*) doest use index?