insert into table from C/C++ application

From: Brian Kurt Fujikawa <bkfujikawa(at)lbl(dot)gov>
To: pgsql-general(at)postgresql(dot)org
Subject: insert into table from C/C++ application
Date: 2001-03-01 17:23:00
Message-ID: 3A9E8574.B3C42BD@lbl.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

I would like to insert values into a table from a C or C++ application.
The only way that I know how to do this is some variation of:

...

PgDatabase my_db("dbname=my_database");

...

char text[256];

sprintf(text,"INSERT INTO my_table VALUES (1,2,3,4,5);");

int err=my_db.ExecCommandOk(text);

...

This seems sort of clumsy to me - especially if the table has many
columns. Is there a better way of doing this?

Thank you very much.

Brian
--
Brian Kurt Fujikawa
Weak Interactions Group
Institute for Nuclear and Particle Astrophysics
Lawrence Berkeley National Laboratory
1 Cyclotron Road, MS 50-208
Berkeley, CA 94720, USA
http://bkf0.lbl.gov/fujikawa/
mailto:bkfujikawa(at)lbl(dot)gov
tel: +1-510-486-4398
fax: +1-510-486-6738

Browse pgsql-general by date

  From Date Subject
Next Message Denis Perchine 2001-03-01 17:25:38 Re: Postgres eats up memory when using cursors
Previous Message ochapiteau 2001-03-01 17:19:43 connect by equivalent