Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix test_stat.c so that it does not cause compilation errors if SQLITE_OMIT_VIRTUALTABLE is defined. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
bf4fc0888705108aab997e1cb491fc7f |
User & Date: | dan 2010-07-12 18:12:41.000 |
Context
2010-07-12
| ||
20:46 | Updates to comments and code organization to reflect changes in os_unix.c; Updated winShmLock() with logic changes from unixShmLock(); Modified IO error returns in winShmMap() to match those in unixShmMap(); (check-in: b73fe2754b user: shaneh tags: trunk) | |
18:12 | Fix test_stat.c so that it does not cause compilation errors if SQLITE_OMIT_VIRTUALTABLE is defined. (check-in: bf4fc08887 user: dan tags: trunk) | |
16:47 | Fix makefiles so that they build sqlite3_analyzer again. Tweaks to comments in test_stat.c. Fix tclsqlite.c to build the sqlite3_analyzer again. (check-in: e6cd15451d user: drh tags: trunk) | |
Changes
Changes to src/test_stat.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ** information from an SQLite database in order to implement the ** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script ** for an example implementation. */ #include "sqliteInt.h" /* ** Page paths: ** ** The value of the 'path' column describes the path taken from the ** root-node of the b-tree structure to each page. The value of the ** root-node path is '/'. ** | > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** information from an SQLite database in order to implement the ** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script ** for an example implementation. */ #include "sqliteInt.h" #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Page paths: ** ** The value of the 'path' column describes the path taken from the ** root-node of the b-tree structure to each page. The value of the ** root-node path is '/'. ** |
︙ | ︙ | |||
561 562 563 564 565 566 567 568 569 570 571 572 573 574 | 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ }; sqlite3_create_module(db, "dbstat", &dbstat_module, 0); return SQLITE_OK; } #ifdef SQLITE_TEST #include <tcl.h> static int test_dbstat( void *clientData, Tcl_Interp *interp, | > > | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ }; sqlite3_create_module(db, "dbstat", &dbstat_module, 0); return SQLITE_OK; } #endif #ifdef SQLITE_TEST #include <tcl.h> static int test_dbstat( void *clientData, Tcl_Interp *interp, |
︙ | ︙ |
Added test/stat.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 43 44 45 46 47 48 49 50 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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | # 2010 July 09 # # 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. The # focus of this file is testing the SELECT statement. # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !vtab { finish_test return } set ::asc 1 proc a_string {n} { string range [string repeat [incr ::asc]. $n] 1 $n } db func a_string a_string register_dbstat_vtab db do_execsql_test stat-0.0 { CREATE VIRTUAL TABLE temp.stat USING dbstat; SELECT * FROM stat; } {} do_execsql_test stat-0.1 { PRAGMA journal_mode = WAL; PRAGMA journal_mode = delete; SELECT * FROM stat; } {wal delete sqlite_master / 1 leaf 0 0 916 0} do_test stat-1.0 { execsql { CREATE TABLE t1(a, b); CREATE INDEX i1 ON t1(b); INSERT INTO t1 VALUES(1, 2); INSERT INTO t1 VALUES(3, 4); } } {} do_test stat-1.1 { execsql { SELECT * FROM stat WHERE name = 't1'; } } {t1 / 2 leaf 2 10 998 5} do_test stat-1.2 { execsql { SELECT * FROM stat WHERE name = 'i1'; } } {i1 / 3 leaf 2 10 1000 5} do_test stat-1.3 { execsql { SELECT * FROM stat WHERE name = 'sqlite_master'; } } {sqlite_master / 1 leaf 2 77 831 40} do_test stat-1.4 { execsql { DROP TABLE t1; } } {} do_execsql_test stat-2.1 { CREATE TABLE t3(a PRIMARY KEY, b); INSERT INTO t3 VALUES(a_string(111), a_string(222)); INSERT INTO t3 SELECT a_string(111+rowid), a_string(222+rowid) FROM t3; INSERT INTO t3 SELECT a_string(111+rowid), a_string(222+rowid) FROM t3; INSERT INTO t3 SELECT a_string(111+rowid), a_string(222+rowid) FROM t3; INSERT INTO t3 SELECT a_string(111+rowid), a_string(222+rowid) FROM t3; INSERT INTO t3 SELECT a_string(111+rowid), a_string(222+rowid) FROM t3; SELECT * FROM stat WHERE name != 'sqlite_master'; } [list \ sqlite_autoindex_t3_1 / 3 internal 3 368 623 125 \ sqlite_autoindex_t3_1 /000/ 8 leaf 8 946 46 123 \ sqlite_autoindex_t3_1 /001/ 9 leaf 8 988 2 131 \ sqlite_autoindex_t3_1 /002/ 15 leaf 7 857 137 132 \ sqlite_autoindex_t3_1 /003/ 20 leaf 6 739 257 129 \ t3 / 2 internal 15 0 907 0 \ t3 /000/ 4 leaf 2 678 328 340 \ t3 /001/ 5 leaf 2 682 324 342 \ t3 /002/ 6 leaf 2 682 324 342 \ t3 /003/ 7 leaf 2 690 316 346 \ t3 /004/ 10 leaf 2 682 324 342 \ t3 /005/ 11 leaf 2 690 316 346 \ t3 /006/ 12 leaf 2 698 308 350 \ t3 /007/ 13 leaf 2 706 300 354 \ t3 /008/ 14 leaf 2 682 324 342 \ t3 /009/ 16 leaf 2 690 316 346 \ t3 /00a/ 17 leaf 2 698 308 350 \ t3 /00b/ 18 leaf 2 706 300 354 \ t3 /00c/ 19 leaf 2 714 292 358 \ t3 /00d/ 21 leaf 2 722 284 362 \ t3 /00e/ 22 leaf 2 730 276 366 \ t3 /00f/ 23 leaf 2 738 268 370 \ ] do_execsql_test stat-2.2 { DROP TABLE t3 } {} do_execsql_test stat-3.1 { CREATE TABLE t4(x); CREATE INDEX i4 ON t4(x); INSERT INTO t4 VALUES(a_string(7777)); SELECT * FROM stat WHERE name != 'sqlite_master'; } [list \ i4 / 3 leaf 1 103 905 7782 \ i4 /000+000000 9 overflow 0 1020 0 0 \ i4 /000+000001 10 overflow 0 1020 0 0 \ i4 /000+000002 11 overflow 0 1020 0 0 \ i4 /000+000003 12 overflow 0 1020 0 0 \ i4 /000+000004 13 overflow 0 1020 0 0 \ i4 /000+000005 14 overflow 0 1020 0 0 \ i4 /000+000006 15 overflow 0 1020 0 0 \ i4 /000+000007 16 overflow 0 539 481 0 \ t4 / 2 leaf 1 640 367 7780 \ t4 /000+000000 22 overflow 0 1020 0 0 \ t4 /000+000001 23 overflow 0 1020 0 0 \ t4 /000+000002 21 overflow 0 1020 0 0 \ t4 /000+000003 20 overflow 0 1020 0 0 \ t4 /000+000004 19 overflow 0 1020 0 0 \ t4 /000+000005 18 overflow 0 1020 0 0 \ t4 /000+000006 17 overflow 0 1020 0 0 \ ] do_execsql_test stat-4.1 { CREATE TABLE t5(x); CREATE INDEX i5 ON t5(x); SELECT * FROM stat WHERE name = 't5' OR name = 'i5'; } [list \ i5 / 5 leaf 0 0 1016 0 \ t5 / 4 leaf 0 0 1016 0 \ ] db close file delete -force test.db sqlite3 db test.db register_dbstat_vtab db breakpoint do_execsql_test stat-5.1 { CREATE VIRTUAL TABLE temp.stat USING dbstat; CREATE TABLE t1(x); INSERT INTO t1 VALUES(zeroblob(1513)); INSERT INTO t1 VALUES(zeroblob(1514)); SELECT * FROM stat WHERE name = 't1'; } [list \ t1 / 2 leaf 2 993 5 1517 \ t1 /000+000000 3 overflow 0 1020 0 0 \ t1 /001+000000 4 overflow 0 1020 0 0 \ ] finish_test |