Hello,

We are using SQLite 3.4.2 and C++.
We've got a problem with transactions...

Here is an example :

CREATE TABLE Account (accountPk INTEGER PRIMARY KEY NOT NULL, number CHAR(10))
CREATE UNIQUE INDEX AccountNumber ON Account (number ASC)

When we try to insert two different rows with the same number we've got the error 19 (Abort due to constraint violation) and that's what we want ! But when we wrap the insert instructions into a transaction, the commit doesn't show us that something has failed (the rows are not inserted)...

INSERT INTO Account VALUES (1,"8888");  --> OK
INSERT INTO Account VALUES (2,"8888");  --> error 19

BEGIN TRANSACTION;
        INSERT INTO Account VALUES (1,"8888");
        INSERT INTO Account VALUES (2,"8888");
COMMIT; --> no error

Why doesn't the commit raise an exception? How can we know that something has failed in a transaction?

Thanks for help,

-----------------------------------
WIESEN Bruno              
17, Rue des pépinières
4632 Cerexhe-Heuseux
------------------------------------
Trav. : [EMAIL PROTECTED]
Pers. : [EMAIL PROTECTED]



Reply via email to