Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The parser now permits very large triggers - triggers with 10000 or more statements. (CVS 3113) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b4fa96d0e92182cd8792e88b4540b959 |
User & Date: | drh 2006-02-27 22:22:28.000 |
Context
2006-02-27
| ||
23:19 | Add a test to make sure parser stack overflow is detected and reported. (CVS 3114) (check-in: 201ab3b523 user: drh tags: trunk) | |
22:22 | The parser now permits very large triggers - triggers with 10000 or more statements. (CVS 3113) (check-in: b4fa96d0e9 user: drh tags: trunk) | |
21:58 | Detect stack overflow in the parser and report an error. (CVS 3112) (check-in: bd2c38f467 user: drh tags: trunk) | |
Changes
Changes to src/parse.y.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** 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. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** 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.198 2006/02/27 22:22:28 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. |
︙ | ︙ | |||
946 947 948 949 950 951 952 | %type when_clause {Expr*} %destructor when_clause {sqlite3ExprDelete($$);} when_clause(A) ::= . { A = 0; } when_clause(A) ::= WHEN expr(X). { A = X; } %type trigger_cmd_list {TriggerStep*} %destructor trigger_cmd_list {sqlite3DeleteTriggerStep($$);} | | > | > | > > > | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | %type when_clause {Expr*} %destructor when_clause {sqlite3ExprDelete($$);} when_clause(A) ::= . { A = 0; } when_clause(A) ::= WHEN expr(X). { A = X; } %type trigger_cmd_list {TriggerStep*} %destructor trigger_cmd_list {sqlite3DeleteTriggerStep($$);} 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($$);} // UPDATE trigger_cmd(A) ::= UPDATE orconf(R) nm(X) SET setlist(Y) where_opt(Z). |
︙ | ︙ |
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.488 2006/02/27 22:22:29 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ /* ** Extra interface definitions for those who need them */ |
︙ | ︙ | |||
1379 1380 1381 1382 1383 1384 1385 | Select *pSelect; /* Valid for SELECT and sometimes INSERT steps (when pExprList == 0) */ Token target; /* Valid for DELETE, UPDATE, INSERT steps */ Expr *pWhere; /* Valid for DELETE, UPDATE steps */ ExprList *pExprList; /* Valid for UPDATE statements and sometimes INSERT steps (when pSelect == 0) */ IdList *pIdList; /* Valid for INSERT statements only */ | < | > | 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | Select *pSelect; /* Valid for SELECT and sometimes INSERT steps (when pExprList == 0) */ Token target; /* Valid for DELETE, UPDATE, INSERT steps */ Expr *pWhere; /* Valid for DELETE, UPDATE steps */ ExprList *pExprList; /* Valid for UPDATE statements and sometimes INSERT steps (when pSelect == 0) */ IdList *pIdList; /* Valid for INSERT statements only */ TriggerStep *pNext; /* Next in the link-list */ TriggerStep *pLast; /* Last element in link-list. Valid for 1st elem only */ }; /* * An instance of struct TriggerStack stores information required during code * generation of a single trigger program. While the trigger program is being * coded, its associated TriggerStack instance is pointed to by the * "pTriggerStack" member of the Parse structure. |
︙ | ︙ |
Added test/trigger8.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # 2006 February 27 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure abusively large triggers # (triggers with 100s or 1000s of statements) work. # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!trigger} { finish_test return } do_test trigger8-1.1 { execsql { CREATE TABLE t1(x); CREATE TABLE t2(y); } set sql "CREATE TRIGGER r10000 AFTER INSERT ON t1 BEGIN\n" for {set i 0} {$i<10000} {incr i} { append sql " INSERT INTO t2 VALUES($i);\n" } append sql "END;" execsql $sql execsql { INSERT INTO t1 VALUES(5); SELECT count(*) FROM t2; } } {10000} finish_test |