Search Postgresql Archives

Re: Postgres Pg_connect PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Tue, Jun 9, 2009 at 10:35 PM, Tory M Blue <tmblue@xxxxxxxxx> 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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux