On 8/28/2013 6:28 PM, jose isaias cabrera wrote:
I know that if I am doing INSERTs and such, I need to,

BEGIN;
     INSERT...
END;

No, you don't need to. You can, if you want to, but there's no reason to have to.

But, do I need to begin if I am going to create a table? ie.

BEGIN;
     CREATE TABLE tableName
     (
         JobID integer primary key, SubProjID integer, ProjID integer
     );
END;

Same here.

Also, what other commands should I wrap with BEGINs and ENDs?

BEGIN starts an explicit transaction; END commits the same. You need an explicit transaction if you want to execute two or more statements atomically, so that either they all succeed, or one fails and then the database is rolled back to the original state.

If you don't start a transaction explicitly, then each statement is implicitly wrapped in its own transaction.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to