Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make sure integer primary keys larger than 2^31 are handled properly. Ticket #1188. (CVS 2436) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1d04c2ab299430959b8a193d4679cbc4 |
User & Date: | drh 2005-03-31 18:40:05.000 |
Context
2005-03-31
| ||
21:02 | Update comments and documentation to give the true maximum page size as 32K, not 64K as was previously (and erroneously) reported. Ticket #1194. (CVS 2437) (check-in: 58dd436b65 user: drh tags: trunk) | |
18:40 | Make sure integer primary keys larger than 2^31 are handled properly. Ticket #1188. (CVS 2436) (check-in: 1d04c2ab29 user: drh tags: trunk) | |
18:26 | Fix a memory leak in the TCL bindings. (CVS 2435) (check-in: c31ea6332f user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.464 2005/03/31 18:40:05 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
1312 1313 1314 1315 1316 1317 1318 | ** does not look like an integer or floating point number) then pop the ** stack and jump to P2. If the top of the stack is numeric then ** convert it into the least integer that is greater than or equal to its ** current value if P1==0, or to the least integer that is strictly ** greater than its current value if P1==1. */ case OP_ForceInt: { /* no-push */ | | | 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | ** does not look like an integer or floating point number) then pop the ** stack and jump to P2. If the top of the stack is numeric then ** convert it into the least integer that is greater than or equal to its ** current value if P1==0, or to the least integer that is strictly ** greater than its current value if P1==1. */ case OP_ForceInt: { /* no-push */ i64 v; assert( pTos>=p->aStack ); applyAffinity(pTos, SQLITE_AFF_INTEGER, db->enc); if( (pTos->flags & (MEM_Int|MEM_Real))==0 ){ Release(pTos); pTos--; pc = pOp->p2 - 1; break; |
︙ | ︙ |
Changes to test/intpkey.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the special processing associated # with INTEGER PRIMARY KEY columns. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the special processing associated # with INTEGER PRIMARY KEY columns. # # $Id: intpkey.test,v 1.22 2005/03/31 18:40:05 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table with a primary key and a datatype other than # integer # |
︙ | ︙ | |||
553 554 555 556 557 558 559 | } {1 1 one} do_test intpkey-14.6 { execsql { SELECT * FROM t3 WHERE a=c; } } {2 2 2 3 3 3} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | } {1 1 one} do_test intpkey-14.6 { execsql { SELECT * FROM t3 WHERE a=c; } } {2 2 2 3 3 3} # Check for proper handling of primary keys greater than 2^31. # Ticket #1188 # do_test intpkey-15.1 { execsql { INSERT INTO t1 VALUES(2147483647, 'big-1', 123); SELECT * FROM t1 WHERE a>2147483648; } } {} do_test intpkey-15.2 { execsql { INSERT INTO t1 VALUES(NULL, 'big-2', 234); SELECT b FROM t1 WHERE a>=2147483648; } } {big-2} do_test intpkey-15.3 { execsql { SELECT b FROM t1 WHERE a>2147483648; } } {} do_test intpkey-15.4 { execsql { SELECT b FROM t1 WHERE a>=2147483647; } } {big-1 big-2} do_test intpkey-15.5 { execsql { SELECT b FROM t1 WHERE a<2147483648; } } {y zero 2 hello second hello b-20 b-22 new 3 big-1} do_test intpkey-15.6 { execsql { SELECT b FROM t1 WHERE a<12345678901; } } {y zero 2 hello second hello b-20 b-22 new 3 big-1 big-2} do_test intpkey-15.7 { execsql { SELECT b FROM t1 WHERE a>12345678901; } } {} finish_test |