1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2391.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,49 @@
1.4 +#
1.5 +# 2007 May 28
1.6 +#
1.7 +# The author disclaims copyright to this source code. In place of
1.8 +# a legal notice, here is a blessing:
1.9 +#
1.10 +# May you do good and not evil.
1.11 +# May you find forgiveness for yourself and forgive others.
1.12 +# May you share freely, never taking more than you give.
1.13 +#
1.14 +#***********************************************************************
1.15 +# $Id: tkt2391.test,v 1.1 2007/05/29 12:11:30 danielk1977 Exp $
1.16 +
1.17 +set testdir [file dirname $argv0]
1.18 +source $testdir/tester.tcl
1.19 +
1.20 +do_test tkt2391.1 {
1.21 + execsql {
1.22 + CREATE TABLE folders(folderid, parentid, foldername COLLATE binary);
1.23 + INSERT INTO folders VALUES(1, 3, 'FolderA');
1.24 + INSERT INTO folders VALUES(1, 3, 'folderB');
1.25 + INSERT INTO folders VALUES(4, 0, 'FolderC');
1.26 + }
1.27 +} {}
1.28 +
1.29 +do_test tkt2391.2 {
1.30 + execsql {
1.31 + SELECT count(*) FROM folders WHERE foldername < 'FolderC';
1.32 + }
1.33 +} {1}
1.34 +
1.35 +do_test tkt2391.3 {
1.36 + execsql {
1.37 + SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase;
1.38 + }
1.39 +} {2}
1.40 +
1.41 +# This demonstrates the bug. Creating the index causes SQLite to ignore
1.42 +# the "COLLATE nocase" clause and use the default collation sequence
1.43 +# for column "foldername" instead (happens to be BINARY in this case).
1.44 +#
1.45 +do_test tkt2391.4 {
1.46 + execsql {
1.47 + CREATE INDEX f_i ON folders(foldername);
1.48 + SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase;
1.49 + }
1.50 +} {2}
1.51 +
1.52 +finish_test