RE: commit work not working?
Posted in 2006
John
Your pseudo code needs to look mor like this:-
begin work
load from fname inset into tableAtest sql result code
if failure
then rollback work
quit
end if
insert tableB
test sql result code
if failure
then rollback work
quit
else
commit work
end if
In dbaccess or isql you manually make the decision to
commit or rollback dependant on whether the inserts are
successful or not, a single stream of commands as below
will always commit the successful portions of the inserts
regardless of the overall success, or otherwise, of the
remaining commands.
Keith
-----Original Message-----
From: jda [mailto:adamski@graceland.edu]
Sent: Thursday, July 20, 2006 7:06 PM
To: informix-list@iiug.org
Subject: commit work not working?
IDS 9.40.HC3 on HP-UX 11i (B.11.11) server
We are having a strange situation with begin/commit work, the commit is
taking place even though an error occurs between the begin & commit
statements. We have a begin work then a load followed by an insert
then the commit work. The load has a duplicate key error, but the
second insert is being committed.
So looks something like this in pseudo code
Begin work;
load from fname insert tableA; insert tableB;
Commit work;
The developer was expecting that when the insert into tableA failed
because of the duplicate key the insert into tableB would be rolled
back and not committed. So he came to me and the way I read the manual
it should have rolled back the insert into tableB.
Even when he copies the 4 lines of code into dbaccess or isql and runs
it, the same thing happens; we get no tableA record but do get a tableB
record. We expected neither to be there after the commit work.
What are we mis-understanding?
John
_______________________________________________
Informix-list mailing list
Informix-list@iiug.org
http://www.iiug.org/mailman/listinfo/informix-list
***********************************************************************************************
This message is sent in strict confidence for the addressee only. It may contain legally privileged information. The contents are not to be disclosed to anyone other than the addressee. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission.
This footnote also confirms that this email message has been swept for the presence of computer viruses, however we cannot guarantee that this message is free from such problems.
***********************************************************************************************