OLD | NEW |
1 # 2001 September 15. | 1 # 2001 September 15. |
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } {} | 485 } {} |
486 do_execsql_test sort-13.2 { | 486 do_execsql_test sort-13.2 { |
487 SELECT a, b FROM t10 ORDER BY a; | 487 SELECT a, b FROM t10 ORDER BY a; |
488 } [db eval {SELECT a, b FROM t10 ORDER BY a, b}] | 488 } [db eval {SELECT a, b FROM t10 ORDER BY a, b}] |
489 do_execsql_test sort-13.3 { | 489 do_execsql_test sort-13.3 { |
490 PRAGMA cache_size = 5; | 490 PRAGMA cache_size = 5; |
491 SELECT a, b FROM t10 ORDER BY a; | 491 SELECT a, b FROM t10 ORDER BY a; |
492 } [db eval {SELECT a, b FROM t10 ORDER BY a, b}] | 492 } [db eval {SELECT a, b FROM t10 ORDER BY a, b}] |
493 | 493 |
494 #------------------------------------------------------------------------- | 494 #------------------------------------------------------------------------- |
495 # Sort some large ( > 4KiB) records. | |
496 # | |
497 proc cksum {x} { | |
498 set i1 1 | |
499 set i2 2 | |
500 binary scan $x c* L | |
501 foreach {a b} $L { | |
502 set i1 [expr (($i2<<3) + $a) & 0x7FFFFFFF] | |
503 set i2 [expr (($i1<<3) + $b) & 0x7FFFFFFF] | |
504 } | |
505 list $i1 $i2 | |
506 } | |
507 db func cksum cksum | |
508 | |
509 do_execsql_test sort-14.0 { | |
510 PRAGMA cache_size = 5; | |
511 CREATE TABLE t11(a, b); | |
512 INSERT INTO t11 VALUES(randomblob(5000), NULL); | |
513 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --2 | |
514 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --3 | |
515 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --4 | |
516 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --5 | |
517 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --6 | |
518 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --7 | |
519 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --8 | |
520 INSERT INTO t11 SELECT randomblob(5000), NULL FROM t11; --9 | |
521 UPDATE t11 SET b = cksum(a); | |
522 } | |
523 | |
524 foreach {tn mmap_limit} { | |
525 1 0 | |
526 2 1000000 | |
527 } { | |
528 do_test sort-14.$tn { | |
529 sqlite3_test_control SQLITE_TESTCTRL_SORTER_MMAP db $mmap_limit | |
530 set prev "" | |
531 db eval { SELECT * FROM t11 ORDER BY b } { | |
532 if {$b != [cksum $a]} {error "checksum failed"} | |
533 if {[string compare $b $prev] < 0} {error "sort failed"} | |
534 set prev $b | |
535 } | |
536 set {} {} | |
537 } {} | |
538 } | |
539 | |
540 #------------------------------------------------------------------------- | |
541 # | 495 # |
542 foreach {tn mmap_limit nWorker tmpstore coremutex fakeheap softheaplimit} { | 496 foreach {tn mmap_limit nWorker tmpstore coremutex fakeheap softheaplimit} { |
543 1 0 3 file true false 0 | 497 1 0 3 file true false 0 |
544 2 0 3 file true true 0 | 498 2 0 3 file true true 0 |
545 3 0 0 file true false 0 | 499 3 0 0 file true false 0 |
546 4 1000000 3 file true false 0 | 500 4 1000000 3 file true false 0 |
547 5 0 0 memory false true 0 | 501 5 0 0 memory false true 0 |
548 6 0 0 file false true 1000000 | 502 6 0 0 file false true 1000000 |
549 7 0 0 file false true 10000 | 503 7 0 0 file false true 10000 |
550 } { | 504 } { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 INSERT INTO t1 VALUES(4, 5, 6); | 589 INSERT INTO t1 VALUES(4, 5, 6); |
636 CREATE UNIQUE INDEX i1 ON t1(b, a, c); | 590 CREATE UNIQUE INDEX i1 ON t1(b, a, c); |
637 } {1 {UNIQUE constraint failed: t1.b, t1.a, t1.c}} | 591 } {1 {UNIQUE constraint failed: t1.b, t1.a, t1.c}} |
638 | 592 |
639 reset_db | 593 reset_db |
640 do_execsql_test 17.1 { | 594 do_execsql_test 17.1 { |
641 SELECT * FROM sqlite_master ORDER BY sql; | 595 SELECT * FROM sqlite_master ORDER BY sql; |
642 } {} | 596 } {} |
643 | 597 |
644 finish_test | 598 finish_test |
OLD | NEW |