Getting "copy from" to work from a C++ program

From: Carlos Moreno <moreno_at_mochima_dot_com(at)mo(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Getting "copy from" to work from a C++ program
Date: 2002-04-04 04:08:35
Message-ID: 3CABD1C3.8020606@mo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


Hi,

I'm trying to insert several records into a table in one shot
(from a C++ program, that is).

All my attempts to use "copy from" have failed (well, I
haven't tried copying from an actual file, since I have
the data in memory, and I'd like to avoid the overhead
to write it to a file first). Is it possible?? I've
tried things like:

PgDatabase db(" ..... ");
db.Exec ("copy deleteme from stdin\n1\tName1\n2\tName2");

And similar things (with a ; after stdin, with a \n. or
\n\\. at the end of the string -- they all fail with an
ErrorMessage() indicating a syntax error in the statement.

Help?!! :-(

Will it be necessary that I dump the data into a temporary
file and then do copy deleteme from tmpfile.txt ??

Thanks,

Carlos
--

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Bruce Momjian 2002-04-04 06:44:31 Re: PyGreSQL bug
Previous Message jacques.talbot 2002-04-03 14:45:36 Symbol main in ./libpgtcl.so is not defined