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

Side by Side Diff: third_party/sqlite/src/test/like.test

Issue 5626002: Update sqlite to 3.7.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/third_party/sqlite/src
Patch Set: Remove misc change. Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/test/jrnlmode2.test ('k') | third_party/sqlite/src/test/lock.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2005 August 13 1 # 2005 August 13
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 #***********************************************************************
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 CREATE INDEX i1 ON t1(x); 187 CREATE INDEX i1 ON t1(x);
188 } 188 }
189 queryplan { 189 queryplan {
190 SELECT x FROM t1 WHERE x LIKE 'abc%' ORDER BY 1; 190 SELECT x FROM t1 WHERE x LIKE 'abc%' ORDER BY 1;
191 } 191 }
192 } {abc abcd nosort {} i1} 192 } {abc abcd nosort {} i1}
193 do_test like-3.4 { 193 do_test like-3.4 {
194 set sqlite_like_count 194 set sqlite_like_count
195 } 0 195 } 0
196 196
197 # The LIKE optimization still works when the RHS is a string with no
198 # wildcard. Ticket [e090183531fc2747]
199 #
200 do_test like-3.4.2 {
201 queryplan {
202 SELECT x FROM t1 WHERE x LIKE 'a' ORDER BY 1;
203 }
204 } {a nosort {} i1}
205 do_test like-3.4.3 {
206 queryplan {
207 SELECT x FROM t1 WHERE x LIKE 'ab' ORDER BY 1;
208 }
209 } {ab nosort {} i1}
210 do_test like-3.4.4 {
211 queryplan {
212 SELECT x FROM t1 WHERE x LIKE 'abcd' ORDER BY 1;
213 }
214 } {abcd nosort {} i1}
215 do_test like-3.4.5 {
216 queryplan {
217 SELECT x FROM t1 WHERE x LIKE 'abcde' ORDER BY 1;
218 }
219 } {nosort {} i1}
220
221
197 # Partial optimization when the pattern does not end in '%' 222 # Partial optimization when the pattern does not end in '%'
198 # 223 #
199 do_test like-3.5 { 224 do_test like-3.5 {
200 set sqlite_like_count 0 225 set sqlite_like_count 0
201 queryplan { 226 queryplan {
202 SELECT x FROM t1 WHERE x LIKE 'a_c' ORDER BY 1; 227 SELECT x FROM t1 WHERE x LIKE 'a_c' ORDER BY 1;
203 } 228 }
204 } {abc nosort {} i1} 229 } {abc nosort {} i1}
205 do_test like-3.6 { 230 do_test like-3.6 {
206 set sqlite_like_count 231 set sqlite_like_count
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 set sqlite_like_count 0 327 set sqlite_like_count 0
303 queryplan { 328 queryplan {
304 PRAGMA case_sensitive_like=off; 329 PRAGMA case_sensitive_like=off;
305 SELECT x FROM t1 WHERE x GLOB 'a[bc]d' ORDER BY 1; 330 SELECT x FROM t1 WHERE x GLOB 'a[bc]d' ORDER BY 1;
306 } 331 }
307 } {abd acd nosort {} i1} 332 } {abd acd nosort {} i1}
308 do_test like-3.24 { 333 do_test like-3.24 {
309 set sqlite_like_count 334 set sqlite_like_count
310 } 6 335 } 6
311 336
337 # GLOB optimization when there is no wildcard. Ticket [e090183531fc2747]
338 #
339 do_test like-3.25 {
340 queryplan {
341 SELECT x FROM t1 WHERE x GLOB 'a' ORDER BY 1;
342 }
343 } {a nosort {} i1}
344 do_test like-3.26 {
345 queryplan {
346 SELECT x FROM t1 WHERE x GLOB 'abcd' ORDER BY 1;
347 }
348 } {abcd nosort {} i1}
349 do_test like-3.27 {
350 queryplan {
351 SELECT x FROM t1 WHERE x GLOB 'abcde' ORDER BY 1;
352 }
353 } {nosort {} i1}
354
355
356
312 # No optimization if the LHS of the LIKE is not a column name or 357 # No optimization if the LHS of the LIKE is not a column name or
313 # if the RHS is not a string. 358 # if the RHS is not a string.
314 # 359 #
315 do_test like-4.1 { 360 do_test like-4.1 {
316 execsql {PRAGMA case_sensitive_like=on} 361 execsql {PRAGMA case_sensitive_like=on}
317 set sqlite_like_count 0 362 set sqlite_like_count 0
318 queryplan { 363 queryplan {
319 SELECT x FROM t1 WHERE x LIKE 'abc%' ORDER BY 1 364 SELECT x FROM t1 WHERE x LIKE 'abc%' ORDER BY 1
320 } 365 }
321 } {abc abcd nosort {} i1} 366 } {abc abcd nosort {} i1}
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 count { 771 count {
727 SELECT a FROM t10b WHERE f GLOB '12*' ORDER BY a; 772 SELECT a FROM t10b WHERE f GLOB '12*' ORDER BY a;
728 } 773 }
729 } {12 123 scan 3 like 0} 774 } {12 123 scan 3 like 0}
730 do_test like-10.15 { 775 do_test like-10.15 {
731 count { 776 count {
732 SELECT a FROM t10b WHERE a GLOB '12*' ORDER BY a; 777 SELECT a FROM t10b WHERE a GLOB '12*' ORDER BY a;
733 } 778 }
734 } {12 123 scan 5 like 6} 779 } {12 123 scan 5 like 6}
735 780
781 # LIKE and GLOB where the default collating sequence is not appropriate
782 # but an index with the appropriate collating sequence exists.
783 #
784 do_test like-11.0 {
785 execsql {
786 CREATE TABLE t11(
787 a INTEGER PRIMARY KEY,
788 b TEXT COLLATE nocase,
789 c TEXT COLLATE binary
790 );
791 INSERT INTO t11 VALUES(1, 'a','a');
792 INSERT INTO t11 VALUES(2, 'ab','ab');
793 INSERT INTO t11 VALUES(3, 'abc','abc');
794 INSERT INTO t11 VALUES(4, 'abcd','abcd');
795 INSERT INTO t11 VALUES(5, 'A','A');
796 INSERT INTO t11 VALUES(6, 'AB','AB');
797 INSERT INTO t11 VALUES(7, 'ABC','ABC');
798 INSERT INTO t11 VALUES(8, 'ABCD','ABCD');
799 INSERT INTO t11 VALUES(9, 'x','x');
800 INSERT INTO t11 VALUES(10, 'yz','yz');
801 INSERT INTO t11 VALUES(11, 'X','X');
802 INSERT INTO t11 VALUES(12, 'YZ','YZ');
803 SELECT count(*) FROM t11;
804 }
805 } {12}
806 do_test like-11.1 {
807 queryplan {
808 PRAGMA case_sensitive_like=OFF;
809 SELECT b FROM t11 WHERE b LIKE 'abc%' ORDER BY a;
810 }
811 } {abc abcd ABC ABCD nosort t11 *}
812 do_test like-11.2 {
813 queryplan {
814 PRAGMA case_sensitive_like=ON;
815 SELECT b FROM t11 WHERE b LIKE 'abc%' ORDER BY a;
816 }
817 } {abc abcd nosort t11 *}
818 do_test like-11.3 {
819 queryplan {
820 PRAGMA case_sensitive_like=OFF;
821 CREATE INDEX t11b ON t11(b);
822 SELECT b FROM t11 WHERE b LIKE 'abc%' ORDER BY a;
823 }
824 } {abc abcd ABC ABCD sort {} t11b}
825 do_test like-11.4 {
826 queryplan {
827 PRAGMA case_sensitive_like=ON;
828 SELECT b FROM t11 WHERE b LIKE 'abc%' ORDER BY a;
829 }
830 } {abc abcd nosort t11 *}
831 do_test like-11.5 {
832 queryplan {
833 PRAGMA case_sensitive_like=OFF;
834 DROP INDEX t11b;
835 CREATE INDEX t11bnc ON t11(b COLLATE nocase);
836 SELECT b FROM t11 WHERE b LIKE 'abc%' ORDER BY a;
837 }
838 } {abc abcd ABC ABCD sort {} t11bnc}
839 do_test like-11.6 {
840 queryplan {
841 CREATE INDEX t11bb ON t11(b COLLATE binary);
842 SELECT b FROM t11 WHERE b LIKE 'abc%' ORDER BY a;
843 }
844 } {abc abcd ABC ABCD sort {} t11bnc}
845 do_test like-11.7 {
846 queryplan {
847 PRAGMA case_sensitive_like=ON;
848 SELECT b FROM t11 WHERE b LIKE 'abc%' ORDER BY a;
849 }
850 } {abc abcd sort {} t11bb}
851 do_test like-11.8 {
852 queryplan {
853 PRAGMA case_sensitive_like=OFF;
854 SELECT b FROM t11 WHERE b GLOB 'abc*' ORDER BY a;
855 }
856 } {abc abcd sort {} t11bb}
857 do_test like-11.9 {
858 queryplan {
859 CREATE INDEX t11cnc ON t11(c COLLATE nocase);
860 CREATE INDEX t11cb ON t11(c COLLATE binary);
861 SELECT c FROM t11 WHERE c LIKE 'abc%' ORDER BY a;
862 }
863 } {abc abcd ABC ABCD sort {} t11cnc}
864 do_test like-11.10 {
865 queryplan {
866 SELECT c FROM t11 WHERE c GLOB 'abc*' ORDER BY a;
867 }
868 } {abc abcd sort {} t11cb}
869
736 870
737 finish_test 871 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/jrnlmode2.test ('k') | third_party/sqlite/src/test/lock.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698