Re: Regarding PQputline and PQendcopy

Поиск
Список
Период
Сортировка
От soni de
Тема Re: Regarding PQputline and PQendcopy
Дата
Msg-id 9f2e40a90611290432g162940edib19bd19f54cabcae@mail.gmail.com
обсуждение исходный текст
Ответ на Regarding PQputline and PQendcopy  ("soni de" <soni.de@gmail.com>)
Ответы Re: Regarding PQputline and PQendcopy  (Richard Huxton <dev@archonet.com>)
Re: Regarding PQputline and PQendcopy  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Any response?

On 11/29/06, soni de <soni.de@gmail.com> wrote:

Hello,

 

We are using PQputline function for copying data to database

Postgres version 7.2.4

 

Following is the code snapshot:

 

We are taking data from one database, 100 records at time and storing that records in string array "strArr"

After filling "strArr", we are passing this string array to PQputline as follows:

 

            res = PQexec(conn, "COPY <tablename> from STDIN");

PQclear(res);

i = 0; 

while(true) {

  status = PQputline(conn,strArr[i]); //contains one row of data

  if(status != 0) {

    cout<<endl<<"Unable to send string: "<< strArr[i] <<endl;

    if (status == EOF) {

            cout<<endl<<"status is EOF"<<endl;

    }

  }

  i++;

  if(i > 100) {

      break;

  }

}

status = PQputline(conn, "\\.\n"); // terminator line

status = PQendcopy(conn); 

 

 

Sometime above code works fine but at sometime PQputline returns EOF and code goes in hang state for PQendcopy function.

How to recognize, why PQputline sends EOF?

Please provide me some help regarding what action must be taken when PQputline returns EOF or PQputline unable to send the line to server.

Also how to avoid the hang state of postgres server in PQendcopy function

 

 

Thanks,

Soni


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: VPATH problems in ECPG again
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: VPATH problems in ECPG again