Search Postgresql Archives

[no subject]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I have a code (libpq):

char textbuffer[120];
res = PQexec(conn, "COPY table_name(\"serial_column",\"int_column",\"bytea_column\") FROM STDIN");
if(PQresultStatus(res) == PGRES_COPY_IN)
{
for(int n=0; n < 10; n++) {
sprintf(textbuffer, "1\t%i\t'text'\n", n);
int copydatares = PQputCopyData(conn, textbuffer, strlen(textbuffer));
}
PQputCopyEnd(conn, NULL);
}ï 

For text data it's ok, but binary data may have '\n' or '\t' characters.
How  correctly write int STDIN binary data?

Help me please! 
Thanks in advanceï.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux