[NOVICE] get error message of COPY command after using PQputCopyEnd
[NOVICE] get error message of COPY command after using PQputCopyEnd
От:
bronstein87 <bumatov@gmail.com>
Дата:
I'm trying to get an error after sending wrong buffer by PQputCopyData.
I do everything according to the documentation:
PGconn* conn=PQconnectdb(qPrintable(conninfo));
if (PQstatus(conn) != CONNECTION_OK)
{
...
}
PQsetClientEncoding(conn,"WIN1251");
PGresult* res=PQexec(conn,"COPY ksv FROM STDIN);
ExecStatusType status= PQresultStatus(res);
PQclear(res);
if(status!=PGRES_COPY_IN)
{
...
}
int
copyStatus=PQputCopyData(conn,bufferToWrite,strlen(bufferToWrite));//
bufferToWrite is wrong
cout()<Re: [NOVICE] get error message of COPY command after using PQputCopyEnd
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
bronstein87 writes: > I'm trying to get an error after sending wrong buffer by PQputCopyData. > ... > so, pqgetresult do not return any error. what im doing wrong? Hm, are you sure the data you're sending is actually wrong? I don't see anything in your code extract that looks wrong. You might try looking in the server log to see what it thinks is happening. regards, tom lane