Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | :-) (CVS 11) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9818723ee127bc535e79f6876546cc02 |
User & Date: | drh 2000-05-30 00:51:27.000 |
Context
2000-05-30
| ||
03:12 | :-) (CVS 12) (check-in: 20f2811fc1 user: drh tags: trunk) | |
00:51 | :-) (CVS 11) (check-in: 9818723ee1 user: drh tags: trunk) | |
00:05 | :-) (CVS 10) (check-in: 1c1d9c0d4a user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains C code routines that are called by the parser ** when syntax rules are reduced. ** | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains C code routines that are called by the parser ** when syntax rules are reduced. ** ** $Id: build.c,v 1.4 2000/05/30 00:51:27 drh Exp $ */ #include "sqliteInt.h" /* ** This routine is called after a single SQL statement has been ** parsed and we want to execute the code to implement ** the statement. Prior action routines should have already |
︙ | ︙ | |||
766 767 768 769 770 771 772 | } if( pField==0 && pList->nExpr!=pTab->nCol ){ char zNum1[30]; char zNum2[30]; sprintf(zNum1,"%d", pList->nExpr); sprintf(zNum2,"%d", pTab->nCol); sqliteSetString(&pParse->zErrMsg, "table ", pTab->zName, | | | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | } if( pField==0 && pList->nExpr!=pTab->nCol ){ char zNum1[30]; char zNum2[30]; sprintf(zNum1,"%d", pList->nExpr); sprintf(zNum2,"%d", pTab->nCol); sqliteSetString(&pParse->zErrMsg, "table ", pTab->zName, " has ", zNum2, " columns but ", zNum1, " values were supplied", 0); pParse->nErr++; goto insert_cleanup; } if( pField!=0 && pList->nExpr!=pField->nId ){ char zNum1[30]; char zNum2[30]; sprintf(zNum1,"%d", pList->nExpr); sprintf(zNum2,"%d", pField->nId); sqliteSetString(&pParse->zErrMsg, zNum1, " values for ", zNum2, " columns", 0); pParse->nErr++; goto insert_cleanup; } if( pField ){ for(i=0; i<pField->nId; i++){ |
︙ | ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | ** will be calling are designed to work with multiple tables and expect ** an IdList* parameter instead of just a Table* parameger. */ pTabList = sqliteIdListAppend(0, pTableName); for(i=0; i<pTabList->nId; i++){ pTabList->a[i].pTab = sqliteFindTable(pParse->db, pTabList->a[i].zName); if( pTabList->a[i].pTab==0 ){ | | | | 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | ** will be calling are designed to work with multiple tables and expect ** an IdList* parameter instead of just a Table* parameger. */ pTabList = sqliteIdListAppend(0, pTableName); for(i=0; i<pTabList->nId; i++){ pTabList->a[i].pTab = sqliteFindTable(pParse->db, pTabList->a[i].zName); if( pTabList->a[i].pTab==0 ){ sqliteSetString(&pParse->zErrMsg, "no such table: ", pTabList->a[i].zName, 0); pParse->nErr++; goto delete_from_cleanup; } if( pTabList->a[i].pTab->readOnly ){ sqliteSetString(&pParse->zErrMsg, "table \"", pTabList->a[i].zName, "\" may not be modified", 0); pParse->nErr++; |
︙ | ︙ |
Added test/delete.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # Copyright (c) 1999, 2000 D. Richard Hipp # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Author contact information: # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the DELETE FROM statement. # # $Id: delete.test,v 1.1 2000/05/30 00:51:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to delete from a non-existant table. # do_test delete-1.1 { set v [catch {execsql {DELETE FROM test1}} msg] lappend v $msg } {1 {no such table: test1}} # Try to delete from sqlite_master # do_test delete-2.1 { set v [catch {execsql {DELETE FROM sqlite_master}} msg] lappend v $msg } {1 {table "sqlite_master" may not be modified}} finish_test |
Added test/insert.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | # Copyright (c) 1999, 2000 D. Richard Hipp # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Author contact information: # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the INSERT statement. # # $Id: insert.test,v 1.1 2000/05/30 00:51:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to insert into a non-existant table. # do_test insert-1.1 { set v [catch {execsql {INSERT INTO test1 VALUES(1,2,3)}} msg] lappend v $msg } {1 {no such table: "test1"}} # Try to insert into sqlite_master # do_test insert-1.2 { set v [catch {execsql {INSERT INTO sqlite_master VALUES(1,2,3,4)}} msg] lappend v $msg } {1 {table "sqlite_master" may not be modified}} # Try to insert the wrong number of entries. # do_test insert-1.3 { execsql {CREATE TABLE test1(one int, two int, three int)} set v [catch {execsql {INSERT INTO test1 VALUES(1,2)}} msg] lappend v $msg } {1 {table test1 has 3 columns but 2 values were supplied}} do_test insert-1.3b { set v [catch {execsql {INSERT INTO test1 VALUES(1,2,3,4)}} msg] lappend v $msg } {1 {table test1 has 3 columns but 4 values were supplied}} do_test insert-1.3c { set v [catch {execsql {INSERT INTO test1(one,two) VALUES(1,2,3,4)}} msg] lappend v $msg } {1 {4 values for 2 columns}} do_test insert-1.3d { set v [catch {execsql {INSERT INTO test1(one,two) VALUES(1)}} msg] lappend v $msg } {1 {1 values for 2 columns}} # Try to insert into a non-existant column of a table. # do_test insert-1.4 { set v [catch {execsql {INSERT INTO test1(one,four) VALUES(1,2)}} msg] lappend v $msg } {1 {table test1 has no column named four}} # Make sure the inserts actually happen # do_test insert-1.5 { execsql {INSERT INTO test1 VALUES(1,2,3)} execsql {SELECT * FROM test1} } {1 2 3} do_test insert-1.5b { execsql {INSERT INTO test1 VALUES(4,5,6)} execsql {SELECT * FROM test1 ORDER BY one} } {1 2 3 4 5 6} do_test insert-1.5c { execsql {INSERT INTO test1 VALUES(7,8,9)} execsql {SELECT * FROM test1 ORDER BY one} } {1 2 3 4 5 6 7 8 9} do_test insert-1.6 { execsql {DELETE FROM test1} execsql {INSERT INTO test1(one,two) VALUES(1,2)} execsql {SELECT * FROM test1 ORDER BY one} } {1 2 {}} do_test insert-1.6b { execsql {INSERT INTO test1(two,three) VALUES(5,6)} execsql {SELECT * FROM test1 ORDER BY one} } {{} 5 6 1 2 {}} do_test insert-1.6c { execsql {INSERT INTO test1(three,one) VALUES(7,8)} execsql {SELECT * FROM test1 ORDER BY one} } {{} 5 6 1 2 {} 8 {} 7} finish_test |
Changes to test/tester.tcl.
︙ | ︙ | |||
19 20 21 22 23 24 25 | # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements some common TCL routines used for regression # testing the SQLite library # | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements some common TCL routines used for regression # testing the SQLite library # # $Id: tester.tcl,v 1.3 2000/05/30 00:51:27 drh Exp $ # Create a test database # file delete -force testdb file mkdir testdb sqlite db testdb |
︙ | ︙ | |||
79 80 81 82 83 84 85 | } # A procedure to execute SQL # proc execsql {sql} { set result {} db eval $sql data { | | < | 79 80 81 82 83 84 85 86 87 88 89 90 91 | } # A procedure to execute SQL # proc execsql {sql} { set result {} db eval $sql data { foreach f $data(*) { lappend result $data($f) } } return $result } |