Annotation of embedaddon/sqlite3/test/tkt2391.test, revision 1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>