From: | "soni de" <soni(dot)de(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Regarding PQputline and PQendcopy |
Date: | 2006-11-29 06:32:07 |
Message-ID: | 9f2e40a90611282232g3edb0d6ds4f6d366c20d3de7f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2006-11-29 09:26:17 | small patch with czech translations for names of months and days |
Previous Message | Euler Taveira de Oliveira | 2006-11-28 22:57:17 | Re: Potential to_char localization bug |