sqlite3-transactions icon indicating copy to clipboard operation
sqlite3-transactions copied to clipboard

no rollback is performed on error

Open fusionstream opened this issue 7 years ago • 0 comments

Running this on a nwjs-compiled sqlite3 in nwjs


db.run ("CREATE TABLE `test` (`index` INTEGER) PRIMARY KEY(`INTEGER`);");

db.beginTransaction(function(err, transaction) {
   transaction.run("INSERT ..."); //left this in by accident and even this did not trigger a rollback
   for (var i = 0; i < 3; i++) {
      transaction.run("INSERT INTO `test` VALUES (1);");
   }
   transaction.commit(function(err) {
      if (err) return console.log("Sad panda :-( commit() failed.", err);
      console.log("Happy panda :-) commit() was successful.");
   });
});

fusionstream avatar Sep 11 '17 15:09 fusionstream