Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!ncs.dnd.ca!rpburry From: rpburry@ncs.dnd.ca (Paul Burry) Newsgroups: comp.databases Subject: Re: ingres embedded SQL/C problem Message-ID: <1991Jan27.154051.8782@ncs.dnd.ca> Date: 27 Jan 91 15:40:51 GMT References: <1991Jan27.023129.721@eng.ufl.edu> Organization: Dept of National Defence Lines: 61 In article <1991Jan27.023129.721@eng.ufl.edu> tsao@helios.tcad.ee.ufl.edu (Tsao) writes: | | Hello, everybody. I just started working with Ingres' embedded SQL |with C, and I have got the following problem: | | I am trying to insert new data into a table, and I have compiled and |run the program without any error, but then I check the table, new data |is not there. | .... | |#include | |main() |{ | exec sql include sqlca; | |exec sql begin declare section; | |/* Description of table testtbl from database vlsi */ | EXEC SQL DECLARE testtbl TABLE | (name char(20), | age integer); | | struct testtbl_ { | char name[21]; | long age; | } testtbl; | |exec sql end declare section; | | exec sql connect 'vlsi'; | exec sql SAVEPOINT savept; | exec sql whenever sqlerror continue; | | strncpy(tbl.name,"dude"); | tbl.age = 20L; | | | exec sql insert into testtbl(name,age) | values (:tbl); | | exec sql ROLLBACK to savept; | | exec sql disconnect; |} Rather than rolling back your transaction when the record was successfully inserted, you should have 'commited': ie. exec sql COMMIT; At least I think that's right. (I always thought Ingres' requirement for explicit commiting of individual statements was a little screwy.) -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Paul Burry Voice: (613)-991-7325 Internet: rpburry@ncs.dnd.ca Fax: (613)-991-7323 UUCP: ..!{uunet,cunews}!ncs.dnd.ca!rpburry