Re: Postgres Pg_connect PHP
| От | Vyacheslav Kalinin |
|---|---|
| Тема | Re: Postgres Pg_connect PHP |
| Дата | |
| Msg-id | 9b1af80e0906091141k78c0e780n59fe29ed608d4092@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Postgres Pg_connect PHP (Tory M Blue <tmblue@gmail.com>) |
| Ответы |
Re: Postgres Pg_connect PHP
|
| Список | pgsql-general |
On Tue, Jun 9, 2009 at 10:35 PM, Tory M Blue <tmblue@gmail.com> wrote:
Thanks guys, the problem with copy from or to is that it creates an
array and thus puts a load of stuff in memory, it's possible the file
will get huge and I can't take that memory hit.
I'll look again and see if I missed something
Thanks
Tory
It's not hard to do some streaming with copy (untested):
$conn = pg_pconnect("dbname=foo");
$fd = fopen('file.dat', 'r');
while (!feof($fd)) {
pg_put_line($conn, fgets($fd));
}
fclose($fd);
pg_put_line($conn, "\\.\n");
pg_end_copy($conn);http://ru.php.net/manual/en/function.pg-put-line.php
В списке pgsql-general по дате отправления: