Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Do not allow an empty string to be inserted into an INTEGER PRIMARY KEY. (CVS 877) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
2aba40bea5fc1c4aef8cfd4c790d4080 |
User & Date: | drh 2003-03-07 19:50:07.000 |
Context
2003-03-19
| ||
03:14 | Modifications to the VDBE to support more than one database file. (CVS 878) (check-in: 875da9eed9 user: drh tags: trunk) | |
2003-03-07
| ||
19:50 | Do not allow an empty string to be inserted into an INTEGER PRIMARY KEY. (CVS 877) (check-in: 2aba40bea5 user: drh tags: trunk) | |
2003-03-01
| ||
19:53 | Add more tests to make sure that sqlite_changes() works when using the non-callback API. Ticket #250. (CVS 876) (check-in: 13e501d190 user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | ** ** 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. ** | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ** ** 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.207 2003/03/07 19:50:07 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** The makefile scans this source file and creates the following ** array of string constants which are the names of all VDBE opcodes. |
︙ | ︙ | |||
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | zNum++; }else if( *zNum=='+' ){ neg = 0; zNum++; }else{ neg = 0; } while( isdigit(*zNum) ){ v = v*10 + *zNum - '0'; zNum++; } *pNum = neg ? -v : v; return *zNum==0; } | > | 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | zNum++; }else if( *zNum=='+' ){ neg = 0; zNum++; }else{ neg = 0; } if( *zNum==0 ) return 0; while( isdigit(*zNum) ){ v = v*10 + *zNum - '0'; zNum++; } *pNum = neg ? -v : v; return *zNum==0; } |
︙ | ︙ | |||
1565 1566 1567 1568 1569 1570 1571 | ** from sqliteMalloc() and p->zErrMsg is made to point to that memory. ** The error code is stored in p->rc and this routine returns SQLITE_ERROR. ** ** If the callback ever returns non-zero, then the program exits ** immediately. There will be no error message but the p->rc field is ** set to SQLITE_ABORT and this routine will return SQLITE_ERROR. ** | | | | 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 | ** from sqliteMalloc() and p->zErrMsg is made to point to that memory. ** The error code is stored in p->rc and this routine returns SQLITE_ERROR. ** ** If the callback ever returns non-zero, then the program exits ** immediately. There will be no error message but the p->rc field is ** set to SQLITE_ABORT and this routine will return SQLITE_ERROR. ** ** A memory allocation error causes p->rc to be set to SQLITE_NOMEM and this ** routine to return SQLITE_ERROR. ** ** Other fatal errors return SQLITE_ERROR. ** ** After this routine has finished, sqliteVdbeFinalize() should be ** used to clean up the mess that was left behind. */ int sqliteVdbeExec( |
︙ | ︙ |
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.13 2003/03/07 19:50:08 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table with a primary key and a datatype other than # integer # |
︙ | ︙ | |||
124 125 126 127 128 129 130 | SELECT * FROM t1 WHERE a==4; } } {4 one two} # Try to insert a non-integer value into the primary key field. This # should result in a data type mismatch. # | | > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | SELECT * FROM t1 WHERE a==4; } } {4 one two} # Try to insert a non-integer value into the primary key field. This # should result in a data type mismatch. # do_test intpkey-1.13.1 { set r [catch {execsql { INSERT INTO t1 VALUES('x','y','z'); }} msg] lappend r $msg } {1 {datatype mismatch}} do_test intpkey-1.13.2 { set r [catch {execsql { INSERT INTO t1 VALUES('','y','z'); }} msg] lappend r $msg } {1 {datatype mismatch}} do_test intpkey-1.14 { set r [catch {execsql { INSERT INTO t1 VALUES(3.4,'y','z'); }} msg] lappend r $msg |
︙ | ︙ |