Re: [sqlite] begin with or without semicolon?

2011-11-20 Thread Igor Tandetnik
Matt Young  wrote:
> In the documentation on trigger, begin has no semicolon, and it works.
> From the command line, I can begin and end transaction, but I need the
> semicolon after begin. Is there a difference?

BEGIN keyword is used in two different contexts, and has different meanings in 
these two contexts. It could start a BEGIN TRANSACTION statement (the 
TRANSACTION keyword can be omitted, so the statement becomes simply BEGIN). Or 
it could indicate the start of a trigger body in CREATE TRIGGER statement.

In sqlite command line application, any statement has to be terminated with a 
semicolon (that's how it knows the statement is complete and is ready to parse 
and execute). That's why you write BEGIN; to start a transaction. In CREATE 
TRIGGER statement, the statement ends with the END keyword, so you put the 
semicolon there. The syntax of the statement itself doesn't call for a 
semicolon after BEGIN keyword.
-- 
Igor Tandetnik

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


[sqlite] begin with or without semicolon?

2011-11-20 Thread Matt Young
In the documentation on trigger, begin has no semicolon, and it works.
 From the command line, I can begin and end transaction, but I need the
semicolon after begin. Is there a difference?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users