Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | All REPLACE INTO syntax inside of triggers. Ticket #610. (CVS 1231) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a6b862a9db6d409a53cc13e7008b27d4 |
User & Date: | drh 2004-02-12 17:28:13.000 |
Context
2004-02-12
| ||
18:46 | Add hooks on each attached database connection for storing auxiliary information. Add the USING clause to ATTACH. (CVS 1232) (check-in: 800c11f4bc user: drh tags: trunk) | |
17:28 | All REPLACE INTO syntax inside of triggers. Ticket #610. (CVS 1231) (check-in: a6b862a9db user: drh tags: trunk) | |
15:32 | Remove unused variable. (CVS 1230) (check-in: 74b234264b 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.108 2004/02/12 17:28:13 drh Exp $ */ %token_prefix TK_ %token_type {Token} %default_type {Token} %extra_argument {Parse *pParse} %syntax_error { if( pParse->zErrMsg==0 ){ |
︙ | ︙ | |||
834 835 836 837 838 839 840 | %type trigger_cmd {TriggerStep *} %destructor trigger_cmd {sqliteDeleteTriggerStep($$);} // UPDATE trigger_cmd(A) ::= UPDATE orconf(R) nm(X) SET setlist(Y) where_opt(Z). { A = sqliteTriggerUpdateStep(&X, Y, Z, R); } // INSERT | | | | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | %type trigger_cmd {TriggerStep *} %destructor trigger_cmd {sqliteDeleteTriggerStep($$);} // UPDATE trigger_cmd(A) ::= UPDATE orconf(R) nm(X) SET setlist(Y) where_opt(Z). { A = sqliteTriggerUpdateStep(&X, Y, Z, R); } // INSERT trigger_cmd(A) ::= insert_cmd(R) INTO nm(X) inscollist_opt(F) VALUES LP itemlist(Y) RP. {A = sqliteTriggerInsertStep(&X, F, Y, 0, R);} trigger_cmd(A) ::= insert_cmd(R) INTO nm(X) inscollist_opt(F) select(S). {A = sqliteTriggerInsertStep(&X, F, 0, S, R);} // DELETE trigger_cmd(A) ::= DELETE FROM nm(X) where_opt(Y). {A = sqliteTriggerDeleteStep(&X, Y);} // SELECT |
︙ | ︙ |
Changes to test/trigger1.test.
︙ | ︙ | |||
387 388 389 390 391 392 393 394 395 | } {trigger} do_test trigger-8.6 { execsql { DROP TRIGGER [trigger]; SELECT name FROM sqlite_master WHERE type='trigger'; } } {} finish_test | > > > > > > > > > > > > > > > > > > > > > | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | } {trigger} do_test trigger-8.6 { execsql { DROP TRIGGER [trigger]; SELECT name FROM sqlite_master WHERE type='trigger'; } } {} # Make sure REPLACE works inside of triggers. # do_test trigger-9.1 { execsql { CREATE TABLE t3(a,b); CREATE TABLE t4(x UNIQUE, b); CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN REPLACE INTO t4 VALUES(new.a,new.b); END; INSERT INTO t3 VALUES(1,2); SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; } } {1 2 99 99 1 2} do_test trigger-9.2 { execsql { INSERT INTO t3 VALUES(1,3); SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; } } {1 2 1 3 99 99 1 3} finish_test |