sl@0
|
1 |
#
|
sl@0
|
2 |
# 2007 May 28
|
sl@0
|
3 |
#
|
sl@0
|
4 |
# The author disclaims copyright to this source code. In place of
|
sl@0
|
5 |
# a legal notice, here is a blessing:
|
sl@0
|
6 |
#
|
sl@0
|
7 |
# May you do good and not evil.
|
sl@0
|
8 |
# May you find forgiveness for yourself and forgive others.
|
sl@0
|
9 |
# May you share freely, never taking more than you give.
|
sl@0
|
10 |
#
|
sl@0
|
11 |
#***********************************************************************
|
sl@0
|
12 |
# $Id: tkt2391.test,v 1.1 2007/05/29 12:11:30 danielk1977 Exp $
|
sl@0
|
13 |
|
sl@0
|
14 |
set testdir [file dirname $argv0]
|
sl@0
|
15 |
source $testdir/tester.tcl
|
sl@0
|
16 |
|
sl@0
|
17 |
do_test tkt2391.1 {
|
sl@0
|
18 |
execsql {
|
sl@0
|
19 |
CREATE TABLE folders(folderid, parentid, foldername COLLATE binary);
|
sl@0
|
20 |
INSERT INTO folders VALUES(1, 3, 'FolderA');
|
sl@0
|
21 |
INSERT INTO folders VALUES(1, 3, 'folderB');
|
sl@0
|
22 |
INSERT INTO folders VALUES(4, 0, 'FolderC');
|
sl@0
|
23 |
}
|
sl@0
|
24 |
} {}
|
sl@0
|
25 |
|
sl@0
|
26 |
do_test tkt2391.2 {
|
sl@0
|
27 |
execsql {
|
sl@0
|
28 |
SELECT count(*) FROM folders WHERE foldername < 'FolderC';
|
sl@0
|
29 |
}
|
sl@0
|
30 |
} {1}
|
sl@0
|
31 |
|
sl@0
|
32 |
do_test tkt2391.3 {
|
sl@0
|
33 |
execsql {
|
sl@0
|
34 |
SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase;
|
sl@0
|
35 |
}
|
sl@0
|
36 |
} {2}
|
sl@0
|
37 |
|
sl@0
|
38 |
# This demonstrates the bug. Creating the index causes SQLite to ignore
|
sl@0
|
39 |
# the "COLLATE nocase" clause and use the default collation sequence
|
sl@0
|
40 |
# for column "foldername" instead (happens to be BINARY in this case).
|
sl@0
|
41 |
#
|
sl@0
|
42 |
do_test tkt2391.4 {
|
sl@0
|
43 |
execsql {
|
sl@0
|
44 |
CREATE INDEX f_i ON folders(foldername);
|
sl@0
|
45 |
SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase;
|
sl@0
|
46 |
}
|
sl@0
|
47 |
} {2}
|
sl@0
|
48 |
|
sl@0
|
49 |
finish_test
|