aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-08-12 01:51:45 +0000
committerdrh <drh@noemail.net>2011-08-12 01:51:45 +0000
commitfaacf17cc1a1d6b062d63a27fca5fa5a87bf3bb9 (patch)
tree1f8b790ae295f34d4700ef6f0c2116bbdbdac402 /test
parent90315a24179a23538b9a906a066d484cd782e3d8 (diff)
downloadsqlite-faacf17cc1a1d6b062d63a27fca5fa5a87bf3bb9.tar.gz
sqlite-faacf17cc1a1d6b062d63a27fca5fa5a87bf3bb9.zip
Begin a branch that experimentally replaces sqlite_stat2 with a new table
called sqlite_stat3 that will hopefully facilitate better query planning decisions. FossilOrigin-Name: 52e1d7e8ddd4bb5ef3a9d00fd2d719a8a784f807
Diffstat (limited to 'test')
-rw-r--r--test/auth.test6
-rw-r--r--test/stat3.test56
2 files changed, 61 insertions, 1 deletions
diff --git a/test/auth.test b/test/auth.test
index 8d2159ecd..5b97a9d74 100644
--- a/test/auth.test
+++ b/test/auth.test
@@ -2324,7 +2324,11 @@ ifcapable compound&&subquery {
ifcapable stat2 {
set stat2 "sqlite_stat2 "
} else {
- set stat2 ""
+ ifcapable stat3 {
+ set stat2 "sqlite_stat3 "
+ } else {
+ set stat2 ""
+ }
}
do_test auth-5.2 {
execsql {
diff --git a/test/stat3.test b/test/stat3.test
new file mode 100644
index 000000000..780a69ce6
--- /dev/null
+++ b/test/stat3.test
@@ -0,0 +1,56 @@
+# 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_STAT2 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,sampleno,sample,neq,nlt);
+ 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; SELECT name FROM sqlite_master ORDER BY 1}
+ } {sqlite_stat1}
+ finish_test
+ return
+}
+
+
+
+
+finish_test