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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 b int, | 347 b int, |
348 c float, | 348 c float, |
349 PRIMARY KEY(b) | 349 PRIMARY KEY(b) |
350 ); | 350 ); |
351 } | 351 } |
352 for {set i 1} {$i<=50} {incr i} { | 352 for {set i 1} {$i<=50} {incr i} { |
353 execsql "INSERT INTO t3 VALUES('x${i}x',$i,0.$i)" | 353 execsql "INSERT INTO t3 VALUES('x${i}x',$i,0.$i)" |
354 } | 354 } |
355 set sqlite_search_count 0 | 355 set sqlite_search_count 0 |
356 concat [execsql {SELECT c FROM t3 WHERE b==10}] $sqlite_search_count | 356 concat [execsql {SELECT c FROM t3 WHERE b==10}] $sqlite_search_count |
357 } {0.1 3} | 357 } {0.1 2} |
358 integrity_check index-11.2 | 358 integrity_check index-11.2 |
359 | 359 |
360 | 360 |
361 # Numeric strings should compare as if they were numbers. So even if the | 361 # Numeric strings should compare as if they were numbers. So even if the |
362 # strings are not character-by-character the same, if they represent the | 362 # strings are not character-by-character the same, if they represent the |
363 # same number they should compare equal to one another. Verify that this | 363 # same number they should compare equal to one another. Verify that this |
364 # is true in indices. | 364 # is true in indices. |
365 # | 365 # |
366 # Updated for sqlite3 v3: SQLite will now store these values as numbers | 366 # Updated for sqlite3 v3: SQLite will now store these values as numbers |
367 # (because the affinity of column a is NUMERIC) so the quirky | 367 # (because the affinity of column a is NUMERIC) so the quirky |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 INSERT INTO t1 VALUES('12.33e04',2); | 525 INSERT INTO t1 VALUES('12.33e04',2); |
526 INSERT INTO t1 VALUES('12.35E4',3); | 526 INSERT INTO t1 VALUES('12.35E4',3); |
527 INSERT INTO t1 VALUES('12.34e',4); | 527 INSERT INTO t1 VALUES('12.34e',4); |
528 INSERT INTO t1 VALUES('12.32e+4',5); | 528 INSERT INTO t1 VALUES('12.32e+4',5); |
529 INSERT INTO t1 VALUES('12.36E+04',6); | 529 INSERT INTO t1 VALUES('12.36E+04',6); |
530 INSERT INTO t1 VALUES('12.36E+',7); | 530 INSERT INTO t1 VALUES('12.36E+',7); |
531 INSERT INTO t1 VALUES('+123.10000E+0003',8); | 531 INSERT INTO t1 VALUES('+123.10000E+0003',8); |
532 INSERT INTO t1 VALUES('+',9); | 532 INSERT INTO t1 VALUES('+',9); |
533 INSERT INTO t1 VALUES('+12347.E+02',10); | 533 INSERT INTO t1 VALUES('+12347.E+02',10); |
534 INSERT INTO t1 VALUES('+12347E+02',11); | 534 INSERT INTO t1 VALUES('+12347E+02',11); |
535 SELECT b FROM t1 ORDER BY a; | 535 INSERT INTO t1 VALUES('+.125E+04',12); |
| 536 INSERT INTO t1 VALUES('-.125E+04',13); |
| 537 INSERT INTO t1 VALUES('.125E+0',14); |
| 538 INSERT INTO t1 VALUES('.125',15); |
| 539 SELECT b FROM t1 ORDER BY a, b; |
536 } | 540 } |
537 } {8 5 2 1 3 6 11 9 10 4 7} | 541 } {13 14 15 12 8 5 2 1 3 6 10 11 9 4 7} |
538 integrity_check index-15.1 | 542 do_test index-15.3 { |
| 543 execsql { |
| 544 SELECT b FROM t1 WHERE typeof(a) IN ('integer','real') ORDER BY b; |
| 545 } |
| 546 } {1 2 3 5 6 8 10 11 12 13 14 15} |
| 547 integrity_check index-15.4 |
539 | 548 |
540 # The following tests - index-16.* - test that when a table definition | 549 # The following tests - index-16.* - test that when a table definition |
541 # includes qualifications that specify the same constraint twice only a | 550 # includes qualifications that specify the same constraint twice only a |
542 # single index is generated to enforce the constraint. | 551 # single index is generated to enforce the constraint. |
543 # | 552 # |
544 # For example: "CREATE TABLE abc( x PRIMARY KEY, UNIQUE(x) );" | 553 # For example: "CREATE TABLE abc( x PRIMARY KEY, UNIQUE(x) );" |
545 # | 554 # |
546 do_test index-16.1 { | 555 do_test index-16.1 { |
547 execsql { | 556 execsql { |
548 CREATE TABLE t7(c UNIQUE PRIMARY KEY); | 557 CREATE TABLE t7(c UNIQUE PRIMARY KEY); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 } | 711 } |
703 } {} | 712 } {} |
704 do_test index-20.2 { | 713 do_test index-20.2 { |
705 execsql { | 714 execsql { |
706 DROP INDEX "t6i1"; | 715 DROP INDEX "t6i1"; |
707 } | 716 } |
708 } {} | 717 } {} |
709 | 718 |
710 | 719 |
711 finish_test | 720 finish_test |
OLD | NEW |