Skip site navigation (1) Skip section navigation (2)

Re: Regarding PQputline and PQendcopy

From: "soni de" <soni(dot)de(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Regarding PQputline and PQendcopy
Date: 2006-11-29 12:32:09
Message-ID: 9f2e40a90611290432g162940edib19bd19f54cabcae@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Any response?

On 11/29/06, soni de <soni(dot)de(at)gmail(dot)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
>

In response to

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2006-11-29 12:33:05
Subject: Re: [HACKERS] VPATH problems in ECPG again
Previous:From: Alvaro HerreraDate: 2006-11-29 12:28:24
Subject: VPATH problems in ECPG again

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group