Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add tests to verify that the busy-handler is invoked correctly when processing "PRAGMA optimize" and ANALYZE commands. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fb83c3d8df250cb701fbe775b48ab93f |
User & Date: | dan 2017-10-04 10:39:28.853 |
Context
2017-10-04
| ||
12:06 | Turn restriction 20 on the query flattener into an assert since the situation restricted can no longer occur because of the more aggressive use of co-routines. (check-in: 4464f40ccd user: drh tags: trunk) | |
10:39 | Add tests to verify that the busy-handler is invoked correctly when processing "PRAGMA optimize" and ANALYZE commands. (check-in: fb83c3d8df user: dan tags: trunk) | |
05:59 | Remove a redundant restriction from the query flattener. (check-in: 66629b2a09 user: drh tags: trunk) | |
Changes
Changes to test/busy.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # 2005 july 8 # # 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 test the busy handler # | < > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # 2005 july 8 # # 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 test the busy handler # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix busy do_test busy-1.1 { sqlite3 db2 test.db execsql { CREATE TABLE t1(x); INSERT INTO t1 VALUES(1); SELECT * FROM t1 |
︙ | ︙ | |||
51 52 53 54 55 56 57 58 | set busyargs {} catchsql COMMIT } {1 {database is locked}} do_test busy-2.2 { set busyargs } {0 1 2 3} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | set busyargs {} catchsql COMMIT } {1 {database is locked}} do_test busy-2.2 { set busyargs } {0 1 2 3} db2 close #------------------------------------------------------------------------- # Test that the busy-handler is invoked correctly for "PRAGMA optimize" # and ANALYZE commnds. ifcapable pragma&&analyze { reset_db do_execsql_test 2.1 { CREATE TABLE t1(x); CREATE TABLE t2(y); CREATE TABLE t3(z); CREATE INDEX i1 ON t1(x); CREATE INDEX i2 ON t2(y); INSERT INTO t1 VALUES(1); INSERT INTO t2 VALUES(1); ANALYZE; SELECT * FROM t1 WHERE x=1; SELECT * FROM t2 WHERE y=1; } {1 1} do_test 2.2 { sqlite3 db2 test.db execsql { BEGIN EXCLUSIVE } db2 catchsql { PRAGMA optimize } } {1 {database is locked}} proc busy_handler {n} { if {$n>1000} { execsql { COMMIT } db2 } return 0 } db busy busy_handler do_test 2.3 { catchsql { PRAGMA optimize } } {0 {}} do_test 2.4 { execsql { BEGIN; SELECT count(*) FROM sqlite_master; } db2 } {6} proc busy_handler {n} { return 1 } do_test 2.5 { catchsql { PRAGMA optimize } } {0 {}} do_test 2.6 { execsql { COMMIT } db2 execsql { WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000 ) INSERT INTO t1 SELECT i FROM s; } execsql { BEGIN; SELECT count(*) FROM sqlite_master; } db2 } {6} do_test 2.7 { catchsql { PRAGMA optimize } } {1 {database is locked}} proc busy_handler {n} { if {$n>1000} { execsql { COMMIT } db2 } return 0 } do_test 2.8 { catchsql { PRAGMA optimize } } {0 {}} } finish_test |