Re: [HACKERS] New COPY commands in libpq

2004-05-01 Thread Tony Reina
I'm a bit rusty on C++ string mashing, but surely sizeof() is not the correct way to determine the number of bytes presently stored in a variable-length string? * PQputCopyEnd(conn, msg); Yes, I've had several people mention this and that did the trick. Thanks to all that replied.

Re: [HACKERS] New COPY commands in libpq

2004-05-01 Thread Tony Reina
You might try porting your code to libpqxx, which is C++-native and should make large swathes of this sort of code unnecessary. I've seriously considered it (along with the npgsql library), but am not really sure as to what the advantage(s) would be considering that (with the corrections

Re: [HACKERS] New COPY commands in libpq

2004-05-01 Thread Jeroen T. Vermeulen
On Sat, May 01, 2004 at 02:25:01AM -0700, Tony Reina wrote: You might try porting your code to libpqxx, which is C++-native and should make large swathes of this sort of code unnecessary. I've seriously considered it (along with the npgsql library), but am not really sure as to what the

[HACKERS] New COPY commands in libpq

2004-04-30 Thread Tony Reina
I read in the manual that the libpq functions PQputline(conn, cmd) and PQendcopy(conn) have been deprecated and that PQputCopyData(conn, cmd, sizeof(cmd)) and PQputCopyEnd(conn, msg) are the replacements. I'm trying to convert a program that works just fine with the old functions. I assume I'm

Re: [HACKERS] New COPY commands in libpq

2004-04-30 Thread Jeroen T. Vermeulen
On Fri, Apr 30, 2004 at 06:12:35AM -0700, Tony Reina wrote: CString cmd, msg; cmd.Format(1\t\2\t{3,4,5}\n); * PQputCopyData(conn, cmd, sizeof(cmd)); cmd.Format(\\.\n); * PQputCopyData(conn, cmd, sizeof(cmd)); * PQputCopyEnd(conn, msg); Old C++

Re: [HACKERS] New COPY commands in libpq

2004-04-30 Thread Tom Lane
[EMAIL PROTECTED] (Tony Reina) writes: * PQputCopyData(conn, cmd, sizeof(cmd)); I'm a bit rusty on C++ string mashing, but surely sizeof() is not the correct way to determine the number of bytes presently stored in a variable-length string? * PQputCopyEnd(conn, msg); You want to