[sqlite] Command line sqlite3 program bug
Hello ! Every day is a day to learn something new ! It also have the command line -bail for my example "sqlite3 -bail a.db < the.sql". Interesting that how easy I can miss the basics "when everything else fail, read the manual !". Thank you ! Cheers ! > Tue Sep 08 2015 9:40:37 pm CEST CEST from "Gerry Snyder" > Subject: Re: [sqlite] Command line sqlite3 >program >bug > > The Command Line Interface has the command: > > ..bail on > > which will do what you want. > > HTH, > > Gerry Snyder > --- > On 9/8/2015 9:54 AM, Domingo Alvarez Duarte wrote: > >>Hello ! >> >> After seem several emails from a user asking about how to use sqlite3 >>through >> shell scripts, I remember my experiences with sqlite3 but didn't mind to >> report it, but now I think that it's worth mention it because it'll hurt >> several users. >> >> The bug/problem is that the sqlite3 command line when feed with a sql >>script >> with commands wrapped by a transaction if there is any error in the middle >>of >> it sqlite3 reports the error but do not stop/abort the transaction and the >> database end up in a dirty state. >> >> __example to show the bug/problem >> >> BEGIN; >> >> DROP TABLE IF EXISTS a; --to allow run more than once >> >> CREATE TABLE a(b); --after the next line error this should be rolled back >> >> INSERT INTO a(c) VALUES(3); -- intentional error and no stop/rollback >> >> INSERT INTO a(b) values(4); >> >> COMMIT; >> >> __ >> >> __blank database after been feed by the above sql script >> >> PRAGMA foreign_keys=OFF; >> BEGIN TRANSACTION; >> CREATE TABLE a(b); >> INSERT INTO "a" VALUES(4); >> COMMIT; >> >> __ >> >> Cheers ! >> ___ >> sqlite-users mailing list >> sqlite-users at mailinglists.sqlite.org >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >> >> > ___ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > > > ?
[sqlite] Command line sqlite3 program bug
Hello ! After seem several emails from a user asking about how to use sqlite3 through shell scripts, I remember my experiences with sqlite3 but didn't mind to report it, but now I think that it's worth mention it because it'll hurt several users. The bug/problem is that the sqlite3 command line when feed with a sql script with commands wrapped by a transaction if there is any error in the middle of it sqlite3 reports the error but do not stop/abort the transaction and the database end up in a dirty state. __example to show the bug/problem BEGIN; DROP TABLE IF EXISTS a; --to allow run more than once CREATE TABLE a(b); --after the next line error this should be rolled back INSERT INTO a(c) VALUES(3); -- intentional error and no stop/rollback INSERT INTO a(b) values(4); COMMIT; __ __blank database after been feed by the above sql script PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE a(b); INSERT INTO "a" VALUES(4); COMMIT; __ Cheers !
[sqlite] Command line sqlite3 program bug
The Command Line Interface has the command: .bail on which will do what you want. HTH, Gerry Snyder --- On 9/8/2015 9:54 AM, Domingo Alvarez Duarte wrote: > Hello ! > > After seem several emails from a user asking about how to use sqlite3 through > shell scripts, I remember my experiences with sqlite3 but didn't mind to > report it, but now I think that it's worth mention it because it'll hurt > several users. > > The bug/problem is that the sqlite3 command line when feed with a sql script > with commands wrapped by a transaction if there is any error in the middle of > it sqlite3 reports the error but do not stop/abort the transaction and the > database end up in a dirty state. > > __example to show the bug/problem > > BEGIN; > > DROP TABLE IF EXISTS a; --to allow run more than once > > CREATE TABLE a(b); --after the next line error this should be rolled back > > INSERT INTO a(c) VALUES(3); -- intentional error and no stop/rollback > > INSERT INTO a(b) values(4); > > COMMIT; > > __ > > __blank database after been feed by the above sql script > > PRAGMA foreign_keys=OFF; > BEGIN TRANSACTION; > CREATE TABLE a(b); > INSERT INTO "a" VALUES(4); > COMMIT; > > __ > > Cheers ! > ___ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >