[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()<