OLD | NEW |
| (Empty) |
1 # 2009 January 29 | |
2 # | |
3 # The author disclaims copyright to this source code. In place of | |
4 # a legal notice, here is a blessing: | |
5 # | |
6 # May you do good and not evil. | |
7 # May you find forgiveness for yourself and forgive others. | |
8 # May you share freely, never taking more than you give. | |
9 # | |
10 #*********************************************************************** | |
11 # | |
12 # Verify that certain keywords can be used as identifiers. | |
13 # | |
14 # $Id: keyword1.test,v 1.1 2009/01/29 19:27:47 drh Exp $ | |
15 | |
16 | |
17 set testdir [file dirname $argv0] | |
18 source $testdir/tester.tcl | |
19 | |
20 db eval { | |
21 CREATE TABLE t1(a, b); | |
22 INSERT INTO t1 VALUES(1, 'one'); | |
23 INSERT INTO t1 VALUES(2, 'two'); | |
24 INSERT INTO t1 VALUES(3, 'three'); | |
25 } | |
26 | |
27 set kwlist { | |
28 abort | |
29 after | |
30 analyze | |
31 asc | |
32 attach | |
33 before | |
34 begin | |
35 by | |
36 cascade | |
37 cast | |
38 column | |
39 conflict | |
40 current_date | |
41 current_time | |
42 current_timestamp | |
43 database | |
44 deferred | |
45 desc | |
46 detach | |
47 end | |
48 each | |
49 exclusive | |
50 explain | |
51 fail | |
52 for | |
53 glob | |
54 if | |
55 ignore | |
56 immediate | |
57 initially | |
58 instead | |
59 key | |
60 like | |
61 match | |
62 of | |
63 offset | |
64 plan | |
65 pragma | |
66 query | |
67 raise | |
68 recursive | |
69 regexp | |
70 reindex | |
71 release | |
72 rename | |
73 replace | |
74 restrict | |
75 rollback | |
76 row | |
77 savepoint | |
78 temp | |
79 temporary | |
80 trigger | |
81 vacuum | |
82 view | |
83 virtual | |
84 with | |
85 without | |
86 }; | |
87 set exprkw { | |
88 cast | |
89 current_date | |
90 current_time | |
91 current_timestamp | |
92 raise | |
93 } | |
94 foreach kw $kwlist { | |
95 do_test keyword1-$kw.1 { | |
96 if {$kw=="if"} { | |
97 db eval "CREATE TABLE \"$kw\"($kw $kw)" | |
98 } else { | |
99 db eval "CREATE TABLE ${kw}($kw $kw)" | |
100 } | |
101 db eval "INSERT INTO $kw VALUES(99)" | |
102 db eval "INSERT INTO $kw SELECT a FROM t1" | |
103 if {[lsearch $exprkw $kw]<0} { | |
104 db eval "SELECT * FROM $kw ORDER BY $kw ASC" | |
105 } else { | |
106 db eval "SELECT * FROM $kw ORDER BY \"$kw\" ASC" | |
107 } | |
108 } {1 2 3 99} | |
109 do_test keyword1-$kw.2 { | |
110 if {$kw=="if"} { | |
111 db eval "DROP TABLE \"$kw\"" | |
112 db eval "CREATE INDEX \"$kw\" ON t1(a)" | |
113 } else { | |
114 db eval "DROP TABLE $kw" | |
115 db eval "CREATE INDEX $kw ON t1(a)" | |
116 } | |
117 db eval "SELECT b FROM t1 INDEXED BY $kw WHERE a=2" | |
118 } {two} | |
119 } | |
120 | |
121 finish_test | |
OLD | NEW |