Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: third_party/sqlite/src/test/tkt-cbd054fa6b.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # 2010 March 25 1 # 2010 March 25
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
11 # 11 #
12 # This file implements tests to verify that ticket [cbd054fa6b] has been 12 # This file implements tests to verify that ticket [cbd054fa6b] has been
13 # fixed. 13 # fixed.
14 # 14 #
15 15
16 set testdir [file dirname $argv0] 16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl 17 source $testdir/tester.tcl
18 18
19 ifcapable !stat2 { 19 ifcapable !stat4&&!stat3 {
20 finish_test 20 finish_test
21 return 21 return
22 } 22 }
23 23
24 proc s {blob} {
25 set ret ""
26 binary scan $blob c* bytes
27 foreach b $bytes {
28 set t [binary format c $b]
29 if {[string is print $t]} {
30 append ret $t
31 } else {
32 append ret .
33 }
34 }
35 return $ret
36 }
37 db function s s
38
24 do_test tkt-cbd05-1.1 { 39 do_test tkt-cbd05-1.1 {
25 db eval { 40 db eval {
26 CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT UNIQUE NOT NULL); 41 CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT UNIQUE NOT NULL);
27 CREATE INDEX t1_x ON t1(b); 42 CREATE INDEX t1_x ON t1(b);
28 INSERT INTO t1 VALUES (NULL, ''); 43 INSERT INTO t1 VALUES (NULL, '');
29 INSERT INTO t1 VALUES (NULL, 'A'); 44 INSERT INTO t1 VALUES (NULL, 'A');
30 INSERT INTO t1 VALUES (NULL, 'B'); 45 INSERT INTO t1 VALUES (NULL, 'B');
31 INSERT INTO t1 VALUES (NULL, 'C'); 46 INSERT INTO t1 VALUES (NULL, 'C');
32 INSERT INTO t1 VALUES (NULL, 'D'); 47 INSERT INTO t1 VALUES (NULL, 'D');
33 INSERT INTO t1 VALUES (NULL, 'E'); 48 INSERT INTO t1 VALUES (NULL, 'E');
34 INSERT INTO t1 VALUES (NULL, 'F'); 49 INSERT INTO t1 VALUES (NULL, 'F');
35 INSERT INTO t1 VALUES (NULL, 'G'); 50 INSERT INTO t1 VALUES (NULL, 'G');
36 INSERT INTO t1 VALUES (NULL, 'H'); 51 INSERT INTO t1 VALUES (NULL, 'H');
37 INSERT INTO t1 VALUES (NULL, 'I'); 52 INSERT INTO t1 VALUES (NULL, 'I');
38 SELECT count(*) FROM t1; 53 SELECT count(*) FROM t1;
39 } 54 }
40 } {10} 55 } {10}
41 do_test tkt-cbd05-1.2 { 56 do_test tkt-cbd05-1.2 {
42 db eval { 57 db eval { ANALYZE; }
43 ANALYZE; 58 ifcapable stat4 {
59 db eval {
60 PRAGMA writable_schema = 1;
61 CREATE VIEW vvv AS
62 SELECT tbl,idx,neq,nlt,ndlt,test_extract(sample,0) AS sample
63 FROM sqlite_stat4;
64 PRAGMA writable_schema = 0;
65 }
66 } else {
67 db eval {
68 CREATE VIEW vvv AS
69 SELECT tbl,idx,neq,nlt,ndlt,sample FROM sqlite_stat3;
70 }
44 } 71 }
45 } {} 72 } {}
46 do_test tkt-cbd05-1.3 { 73 do_test tkt-cbd05-1.3 {
47 execsql { 74 execsql {
48 SELECT tbl,idx,group_concat(sample,' ') 75 SELECT tbl,idx,group_concat(s(sample),' ')
49 FROM sqlite_stat2 76 FROM vvv
50 WHERE idx = 't1_x' 77 WHERE idx = 't1_x'
51 GROUP BY tbl,idx 78 GROUP BY tbl,idx
52 } 79 }
53 } {t1 t1_x { A B C D E F G H I}} 80 } {t1 t1_x { A B C D E F G H I}}
54 81
55 do_test tkt-cbd05-2.1 { 82 do_test tkt-cbd05-2.1 {
56 db eval { 83 db eval {
57 DROP TABLE t1; 84 DROP TABLE t1;
58 CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB UNIQUE NOT NULL); 85 CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB UNIQUE NOT NULL);
59 CREATE INDEX t1_x ON t1(b); 86 CREATE INDEX t1_x ON t1(b);
(...skipping 10 matching lines...) Expand all
70 SELECT count(*) FROM t1; 97 SELECT count(*) FROM t1;
71 } 98 }
72 } {10} 99 } {10}
73 do_test tkt-cbd05-2.2 { 100 do_test tkt-cbd05-2.2 {
74 db eval { 101 db eval {
75 ANALYZE; 102 ANALYZE;
76 } 103 }
77 } {} 104 } {}
78 do_test tkt-cbd05-2.3 { 105 do_test tkt-cbd05-2.3 {
79 execsql { 106 execsql {
80 SELECT tbl,idx,group_concat(sample,' ') 107 SELECT tbl,idx,group_concat(s(sample),' ')
81 FROM sqlite_stat2 108 FROM vvv
82 WHERE idx = 't1_x' 109 WHERE idx = 't1_x'
83 GROUP BY tbl,idx 110 GROUP BY tbl,idx
84 } 111 }
85 } {t1 t1_x { A B C D E F G H I}} 112 } {t1 t1_x { A B C D E F G H I}}
86 113
87 finish_test 114 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698