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

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

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months 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
« no previous file with comments | « third_party/sqlite/src/test/index8.test ('k') | third_party/sqlite/src/test/instr.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 # 2015-08-31 1 # 2015-08-31
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 CREATE INDEX i ON t0(a in(0,1)); 316 CREATE INDEX i ON t0(a in(0,1));
317 INSERT INTO t0 VALUES(0,1,2),(2,3,4),(5,6,7); 317 INSERT INTO t0 VALUES(0,1,2),(2,3,4),(5,6,7);
318 UPDATE t0 SET b=99 WHERE (a in(0,1))=0; 318 UPDATE t0 SET b=99 WHERE (a in(0,1))=0;
319 SELECT *, '|' FROM t0 ORDER BY +a; 319 SELECT *, '|' FROM t0 ORDER BY +a;
320 } {0 1 2 | 2 99 4 | 5 99 7 |} 320 } {0 1 2 | 2 99 4 | 5 99 7 |}
321 do_execsql_test indexexpr1-1010 { 321 do_execsql_test indexexpr1-1010 {
322 UPDATE t0 SET b=88 WHERE (a in(0,1))=1; 322 UPDATE t0 SET b=88 WHERE (a in(0,1))=1;
323 SELECT *, '|' FROM t0 ORDER BY +a; 323 SELECT *, '|' FROM t0 ORDER BY +a;
324 } {0 88 2 | 2 99 4 | 5 99 7 |} 324 } {0 88 2 | 2 99 4 | 5 99 7 |}
325 325
326 # 2016-10-10
327 # Make sure indexes on expressions skip over initial NULL values in the
328 # index as they are suppose to do.
329 # Ticket https://www.sqlite.org/src/tktview/4baa46491212947
330 #
331 do_execsql_test indexexpr1-1100 {
332 DROP TABLE IF EXISTS t1;
333 CREATE TABLE t1(a);
334 INSERT INTO t1 VALUES(NULL),(1);
335 SELECT '1:', typeof(a), a FROM t1 WHERE a<10;
336 SELECT '2:', typeof(a), a FROM t1 WHERE a+0<10;
337 CREATE INDEX t1x1 ON t1(a);
338 CREATE INDEX t1x2 ON t1(a+0);
339 SELECT '3:', typeof(a), a FROM t1 WHERE a<10;
340 SELECT '4:', typeof(a), a FROM t1 WHERE a+0<10;
341 } {1: integer 1 2: integer 1 3: integer 1 4: integer 1}
342
343 do_execsql_test indexexpr1-1200 {
344 CREATE TABLE t10(a int, b int, c int, d int);
345 INSERT INTO t10(a, b, c, d) VALUES(0, 0, 2, 2);
346 INSERT INTO t10(a, b, c, d) VALUES(0, 0, 0, 0);
347 INSERT INTO t10(a, b, c, d) VALUES(0, 0, 1, 1);
348 INSERT INTO t10(a, b, c, d) VALUES(1, 1, 1, 1);
349 INSERT INTO t10(a, b, c, d) VALUES(1, 1, 0, 0);
350 INSERT INTO t10(a, b, c, d) VALUES(2, 2, 0, 0);
351
352 SELECT a+b, c+d FROM t10 ORDER BY a+b, c+d;
353 } {
354 0 0 0 2 0 4 2 0 2 2 4 0
355 }
356 do_execsql_test indexexpr1-1200.1 {
357 CREATE INDEX t10_ab ON t10(a+b);
358 }
359 do_execsql_test indexexpr1-1200.2 {
360 SELECT a+b, c+d FROM t10 ORDER BY a+b, c+d;
361 } {
362 0 0 0 2 0 4 2 0 2 2 4 0
363 }
364 do_execsql_test indexexpr1-1200.3 {
365 CREATE INDEX t10_abcd ON t10(a+b,c+d);
366 }
367 do_execsql_test indexexpr1-1200.4 {
368 SELECT a+b, c+d FROM t10 ORDER BY a+b, c+d;
369 } {
370 0 0 0 2 0 4 2 0 2 2 4 0
371 }
372
373 # Ticket https://www.sqlite.org/src/tktview/eb703ba7b50c1a
374 # Incorrect result using an index on an expression with a collating function
375 #
376 do_execsql_test indexexpr1-1300.1 {
377 CREATE TABLE t1300(a INTEGER PRIMARY KEY, b);
378 INSERT INTO t1300 VALUES(1,'coffee'),(2,'COFFEE'),(3,'stress'),(4,'STRESS');
379 CREATE INDEX t1300bexpr ON t1300( substr(b,4) );
380 SELECT a FROM t1300 WHERE substr(b,4)='ess' COLLATE nocase ORDER BY +a;
381 } {3 4}
326 382
327 finish_test 383 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/index8.test ('k') | third_party/sqlite/src/test/instr.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698