Re: bulk insert using COPY and PHP code

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: bulk insert using COPY and PHP code
Дата
Msg-id AANLkTimI0MjRa_q6xUzu2zRq2Rcud6ZPtTdmnDKk--A5@mail.gmail.com
обсуждение исходный текст
Ответ на bulk insert using COPY and PHP code  (Babu R <babu_4blog@yahoo.com>)
Ответы Re: bulk insert using COPY and PHP code  (Babu R <babu_4blog@yahoo.com>)
Список pgsql-general
2010/7/2 Babu R <babu_4blog@yahoo.com>
>
> Hello,
>
> Am exploring a way for bulk insert using \COPY with the CSV format data using PHP code. Is there any way to achieve
this?
>
> Thanks,
> - Babu
>
hello

look on http://php.net/manual/en/function.pg-put-line.php


<?php
  $conn = pg_pconnect("dbname=foo");
  pg_query($conn, "create table bar (a int4, b char(16), d float8)");
  pg_query($conn, "copy bar from stdin");
  pg_put_line($conn, "3\thello world\t4.5\n");
  pg_put_line($conn, "4\tgoodbye world\t7.11\n");
  pg_put_line($conn, "\\.\n");
  pg_end_copy($conn);
?>

Regards

Pavel Stehule

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

Предыдущее
От: Babu R
Дата:
Сообщение: bulk insert using COPY and PHP code
Следующее
От: Geoffrey
Дата:
Сообщение: pgpool-II (max_pool and num_init_children)