Re: Storing an array to Postgresql table

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Storing an array to Postgresql table
Дата
Msg-id 20050619052726.GA13971@winnie.fuhr.org
обсуждение исходный текст
Ответ на Storing an array to Postgresql table  ("Mark J. Bailey" <mjb@jobsoft.com>)
Список pgsql-novice
On Fri, Jun 17, 2005 at 09:04:32AM -0500, Mark J. Bailey wrote:
>
> so, what i am looking for essentially is an equiv to "COPY FROM" except
> the "source" is @fields and not a file.

You could use COPY FROM STDIN and pg_putline -- you wouldn't even
need to split the record:

$dbh->do("COPY foo (a, b, c, d, e) FROM STDIN WITH DELIMITER '|'");
$dbh->pg_putline("1|2|3|4|5\n");
$dbh->pg_putline("6|7|8|9|10\n");
$dbh->pg_putline("11|12|13|14|15\n");
$dbh->pg_putline("16|17|18|19|20\n");
$dbh->pg_endcopy;

See "COPY support" in the DBD::Pg documentation for more info:

http://search.cpan.org/~dbdpg/DBD-Pg-1.42/Pg.pm#COPY_support

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: rabt@dim.uchile.cl
Дата:
Сообщение: BIG files
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: [despammed] allowing ',' (comma) in float8