OLD | NEW |
1 # 2014 June 17 | 1 # 2014 June 17 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #************************************************************************* | 10 #************************************************************************* |
(...skipping 23 matching lines...) Expand all Loading... |
34 do_faultsim_test 1 -faults oom-* -prep { | 34 do_faultsim_test 1 -faults oom-* -prep { |
35 faultsim_restore_and_reopen | 35 faultsim_restore_and_reopen |
36 execsql { SELECT * FROM xx } | 36 execsql { SELECT * FROM xx } |
37 } -body { | 37 } -body { |
38 execsql { DROP TABLE xx } | 38 execsql { DROP TABLE xx } |
39 } -test { | 39 } -test { |
40 faultsim_test_result [list 0 {}] | 40 faultsim_test_result [list 0 {}] |
41 } | 41 } |
42 | 42 |
43 #------------------------------------------------------------------------- | 43 #------------------------------------------------------------------------- |
44 # An OOM within an "ORDER BY rank" query. | |
45 # | |
46 db func rnddoc fts5_rnddoc | |
47 do_execsql_test 2.0 { | |
48 CREATE VIRTUAL TABLE xx USING fts5(x); | |
49 INSERT INTO xx VALUES ('abc ' || rnddoc(10)); | |
50 INSERT INTO xx VALUES ('abc abc' || rnddoc(9)); | |
51 INSERT INTO xx VALUES ('abc abc abc' || rnddoc(8)); | |
52 } {} | |
53 faultsim_save_and_close | |
54 | |
55 do_faultsim_test 2 -faults oom-* -prep { | |
56 faultsim_restore_and_reopen | |
57 execsql { SELECT * FROM xx } | |
58 } -body { | |
59 execsql { SELECT rowid FROM xx WHERE xx MATCH 'abc' ORDER BY rank } | |
60 } -test { | |
61 faultsim_test_result [list 0 {3 2 1}] | |
62 } | |
63 | |
64 #------------------------------------------------------------------------- | |
65 # An OOM while "reseeking" an FTS cursor. | 44 # An OOM while "reseeking" an FTS cursor. |
66 # | 45 # |
67 do_execsql_test 3.0 { | 46 do_execsql_test 3.0 { |
68 CREATE VIRTUAL TABLE jj USING fts5(j); | 47 CREATE VIRTUAL TABLE jj USING fts5(j); |
69 INSERT INTO jj(rowid, j) VALUES(101, 'm t w t f s s'); | 48 INSERT INTO jj(rowid, j) VALUES(101, 'm t w t f s s'); |
70 INSERT INTO jj(rowid, j) VALUES(202, 't w t f s'); | 49 INSERT INTO jj(rowid, j) VALUES(202, 't w t f s'); |
71 INSERT INTO jj(rowid, j) VALUES(303, 'w t f'); | 50 INSERT INTO jj(rowid, j) VALUES(303, 'w t f'); |
72 INSERT INTO jj(rowid, j) VALUES(404, 't'); | 51 INSERT INTO jj(rowid, j) VALUES(404, 't'); |
73 } | 52 } |
74 faultsim_save_and_close | 53 faultsim_save_and_close |
(...skipping 25 matching lines...) Expand all Loading... |
100 | 79 |
101 WITH ii(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM ii WHERE i<10 ) | 80 WITH ii(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM ii WHERE i<10 ) |
102 INSERT INTO x1 SELECT rnddoc(5) FROM ii; | 81 INSERT INTO x1 SELECT rnddoc(5) FROM ii; |
103 } | 82 } |
104 | 83 |
105 set ::res [db eval {SELECT rowid, x1 FROM x1 WHERE x1 MATCH '*reads'}] | 84 set ::res [db eval {SELECT rowid, x1 FROM x1 WHERE x1 MATCH '*reads'}] |
106 | 85 |
107 do_faultsim_test 4 -faults oom-* -body { | 86 do_faultsim_test 4 -faults oom-* -body { |
108 db eval {SELECT rowid, x, x1 FROM x1 WHERE x1 MATCH '*reads'} | 87 db eval {SELECT rowid, x, x1 FROM x1 WHERE x1 MATCH '*reads'} |
109 } -test { | 88 } -test { |
110 faultsim_test_result {0 {0 {} 4}} | 89 faultsim_test_result {0 {0 {} 3}} |
111 } | 90 } |
112 | 91 |
113 #------------------------------------------------------------------------- | 92 #------------------------------------------------------------------------- |
114 # An OOM within a query that uses a custom rank function. | 93 # An OOM within a query that uses a custom rank function. |
115 # | 94 # |
116 reset_db | 95 reset_db |
117 do_execsql_test 5.0 { | 96 do_execsql_test 5.0 { |
118 PRAGMA encoding='utf16'; | 97 PRAGMA encoding='utf16'; |
119 CREATE VIRTUAL TABLE x2 USING fts5(x); | 98 CREATE VIRTUAL TABLE x2 USING fts5(x); |
120 INSERT INTO x2(rowid, x) VALUES(10, 'a b c'); -- 3 | 99 INSERT INTO x2(rowid, x) VALUES(10, 'a b c'); -- 3 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 faultsim_restore_and_reopen | 389 faultsim_restore_and_reopen |
411 db eval { SELECT * FROM "tbl one" } | 390 db eval { SELECT * FROM "tbl one" } |
412 } -body { | 391 } -body { |
413 db eval { ALTER TABLE "tbl one" RENAME TO "tbl two" } | 392 db eval { ALTER TABLE "tbl one" RENAME TO "tbl two" } |
414 } -test { | 393 } -test { |
415 faultsim_test_result {0 {}} | 394 faultsim_test_result {0 {}} |
416 } | 395 } |
417 | 396 |
418 finish_test | 397 finish_test |
419 | 398 |
OLD | NEW |