From 569c6676a6ddb0ff73821d7693b5e18ddef809b9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 16 Oct 2014 22:51:35 -0400 Subject: Imported Upstream version 3.2.0 --- test/tkt-cbd054fa6b.test | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'test/tkt-cbd054fa6b.test') diff --git a/test/tkt-cbd054fa6b.test b/test/tkt-cbd054fa6b.test index 51e0199..2951233 100644 --- a/test/tkt-cbd054fa6b.test +++ b/test/tkt-cbd054fa6b.test @@ -16,11 +16,26 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl -ifcapable !stat3 { +ifcapable !stat4&&!stat3 { finish_test return } +proc s {blob} { + set ret "" + binary scan $blob c* bytes + foreach b $bytes { + set t [binary format c $b] + if {[string is print $t]} { + append ret $t + } else { + append ret . + } + } + return $ret +} +db function s s + do_test tkt-cbd05-1.1 { db eval { CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT UNIQUE NOT NULL); @@ -39,18 +54,30 @@ do_test tkt-cbd05-1.1 { } } {10} do_test tkt-cbd05-1.2 { - db eval { - ANALYZE; + db eval { ANALYZE; } + ifcapable stat4 { + db eval { + PRAGMA writable_schema = 1; + CREATE VIEW vvv AS + SELECT tbl,idx,neq,nlt,ndlt,test_extract(sample,0) AS sample + FROM sqlite_stat4; + PRAGMA writable_schema = 0; + } + } else { + db eval { + CREATE VIEW vvv AS + SELECT tbl,idx,neq,nlt,ndlt,sample FROM sqlite_stat3; + } } } {} do_test tkt-cbd05-1.3 { execsql { - SELECT tbl,idx,group_concat(sample,' ') - FROM sqlite_stat3 + SELECT tbl,idx,group_concat(s(sample),' ') + FROM vvv WHERE idx = 't1_x' GROUP BY tbl,idx } -} {/t1 t1_x .[ ABCDEFGHI]{10}./} +} {t1 t1_x { A B C D E F G H I}} do_test tkt-cbd05-2.1 { db eval { @@ -77,11 +104,11 @@ do_test tkt-cbd05-2.2 { } {} do_test tkt-cbd05-2.3 { execsql { - SELECT tbl,idx,group_concat(sample,' ') - FROM sqlite_stat3 + SELECT tbl,idx,group_concat(s(sample),' ') + FROM vvv WHERE idx = 't1_x' GROUP BY tbl,idx } -} {/t1 t1_x .[ ABCDEFGHI]{10}./} +} {t1 t1_x { A B C D E F G H I}} finish_test -- cgit v1.2.3