/ Check-in [571adab9d2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Disallow empty triggers. Ticket #3283. This does not present a backwards compatibility problem because prior to this change, an empty trigger would segfault. (CVS 5550)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 571adab9d2215fac6ed375257a070b8ffa9d9808
User & Date: drh 2008-08-11 14:26:35
Context
2008-08-11
17:27
Added SQLITE_EXPERIMENTAL and SQLITE_DEPRECATED tags to APIs to take advantage of compiler warnings (with the necessary function attributes.) Ticket #3142. (CVS 5551) check-in: 5f4b547aba user: shane tags: trunk
14:26
Disallow empty triggers. Ticket #3283. This does not present a backwards compatibility problem because prior to this change, an empty trigger would segfault. (CVS 5550) check-in: 571adab9d2 user: drh tags: trunk
2008-08-08
18:06
Move a variable initialization earlier to work around MS compiler complaints. (CVS 5549) check-in: 02232e7144 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/parse.y.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
986
987
988
989
990
991
992

993
994
995
996
997



998
999
1000
1001





1002
1003
1004
1005
1006
1007
1008
**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.250 2008/08/08 15:06:22 drh Exp $
*/

// All token codes are small integers with #defines that begin with "TK_"
%token_prefix TK_

// The type of the data attached to each token is Token.  This is also the
// default type for non-terminals.
................................................................................
%destructor when_clause {sqlite3ExprDelete(pParse->db, $$);}
when_clause(A) ::= .             { A = 0; }
when_clause(A) ::= WHEN expr(X). { A = X; }

%type trigger_cmd_list {TriggerStep*}
%destructor trigger_cmd_list {sqlite3DeleteTriggerStep(pParse->db, $$);}
trigger_cmd_list(A) ::= trigger_cmd_list(Y) trigger_cmd(X) SEMI. {

  if( Y ){
    Y->pLast->pNext = X;
  }else{
    Y = X;
  }



  Y->pLast = X;
  A = Y;
}
trigger_cmd_list(A) ::= . { A = 0; }






%type trigger_cmd {TriggerStep*}
%destructor trigger_cmd {sqlite3DeleteTriggerStep(pParse->db, $$);}
// UPDATE 
trigger_cmd(A) ::= UPDATE orconf(R) nm(X) SET setlist(Y) where_opt(Z).  
               { A = sqlite3TriggerUpdateStep(pParse->db, &X, Y, Z, R); }








|







 







>





>
>
>



|
>
>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.251 2008/08/11 14:26:35 drh Exp $
*/

// All token codes are small integers with #defines that begin with "TK_"
%token_prefix TK_

// The type of the data attached to each token is Token.  This is also the
// default type for non-terminals.
................................................................................
%destructor when_clause {sqlite3ExprDelete(pParse->db, $$);}
when_clause(A) ::= .             { A = 0; }
when_clause(A) ::= WHEN expr(X). { A = X; }

%type trigger_cmd_list {TriggerStep*}
%destructor trigger_cmd_list {sqlite3DeleteTriggerStep(pParse->db, $$);}
trigger_cmd_list(A) ::= trigger_cmd_list(Y) trigger_cmd(X) SEMI. {
/*
  if( Y ){
    Y->pLast->pNext = X;
  }else{
    Y = X;
  }
*/
  assert( Y!=0 );
  Y->pLast->pNext = X;
  Y->pLast = X;
  A = Y;
}
trigger_cmd_list(A) ::= trigger_cmd(X) SEMI. { 
  /* if( X ) */
  assert( X!=0 );
  X->pLast = X;
  A = X;
}

%type trigger_cmd {TriggerStep*}
%destructor trigger_cmd {sqlite3DeleteTriggerStep(pParse->db, $$);}
// UPDATE 
trigger_cmd(A) ::= UPDATE orconf(R) nm(X) SET setlist(Y) where_opt(Z).  
               { A = sqlite3TriggerUpdateStep(pParse->db, &X, Y, Z, R); }