blob: 9477672f27b58ecc16cbdb802982393f6ea64f6b [file] [edit]
# 2011 August 08
#
# 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. This file
# implements tests for the extra functionality provided by the ANALYZE
# command when the library is compiled with SQLITE_ENABLE_STAT3 defined.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix stat3
# Verify that if not compiled with SQLITE_ENABLE_STAT2 that the ANALYZE
# command will delete the sqlite_stat2 table. Likewise, if not compiled
# with SQLITE_ENABLE_STAT3, the sqlite_stat3 table is deleted.
#
do_test 1.1 {
db eval {
PRAGMA writable_schema=ON;
CREATE TABLE sqlite_stat2(tbl,idx,sampleno,sample);
CREATE TABLE sqlite_stat3(tbl,idx,neq,nlt,ndlt,sample);
SELECT name FROM sqlite_master ORDER BY 1;
}
} {sqlite_stat2 sqlite_stat3}
do_test 1.2 {
db close
sqlite3 db test.db
db eval {SELECT name FROM sqlite_master ORDER BY 1}
} {sqlite_stat2 sqlite_stat3}
ifcapable {stat3} {
do_test 1.3 {
db eval {ANALYZE; SELECT name FROM sqlite_master ORDER BY 1}
} {sqlite_stat1 sqlite_stat3}
} else {
do_test 1.4 {
db eval {ANALYZE; ANALYZE; SELECT name FROM sqlite_master ORDER BY 1}
} {sqlite_stat1}
finish_test
return
}
finish_test