insert into table from C/C++ application - Mailing list pgsql-general

From Brian Kurt Fujikawa
Subject insert into table from C/C++ application
Date
Msg-id 3A9E8574.B3C42BD@lbl.gov
Whole thread Raw
List 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@lbl.gov
tel: +1-510-486-4398
fax: +1-510-486-6738

pgsql-general by date:

Previous
From: "Gregory Wood"
Date:
Subject: Re: JOIN of a table with many detail tables
Next
From: Geoff Russell
Date:
Subject: Set Operators and Arrays Question