tkt2391.test 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. set testdir [file dirname $argv0]
  14. source $testdir/tester.tcl
  15. do_test tkt2391.1 {
  16. execsql {
  17. CREATE TABLE folders(folderid, parentid, foldername COLLATE binary);
  18. INSERT INTO folders VALUES(1, 3, 'FolderA');
  19. INSERT INTO folders VALUES(1, 3, 'folderB');
  20. INSERT INTO folders VALUES(4, 0, 'FolderC');
  21. }
  22. } {}
  23. do_test tkt2391.2 {
  24. execsql {
  25. SELECT count(*) FROM folders WHERE foldername < 'FolderC';
  26. }
  27. } {1}
  28. do_test tkt2391.3 {
  29. execsql {
  30. SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase;
  31. }
  32. } {2}
  33. # This demonstrates the bug. Creating the index causes SQLite to ignore
  34. # the "COLLATE nocase" clause and use the default collation sequence
  35. # for column "foldername" instead (happens to be BINARY in this case).
  36. #
  37. do_test tkt2391.4 {
  38. execsql {
  39. CREATE INDEX f_i ON folders(foldername);
  40. SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase;
  41. }
  42. } {2}
  43. finish_test