1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

:-) (CVS 11)

FossilOrigin-Name: 9818723ee127bc535e79f6876546cc027b4999e6
This commit is contained in:
drh
2000-05-30 00:51:26 +00:00
parent a5c2f08f20
commit 62c6819115
6 changed files with 165 additions and 16 deletions

View File

@ -1,12 +1,12 @@
C :-)\s(CVS\s10) C :-)\s(CVS\s11)
D 2000-05-30T00:05:13 D 2000-05-30T00:51:27
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 89921c1ee4de75275bfadfbac198396da31704d1 F Makefile.in 89921c1ee4de75275bfadfbac198396da31704d1
F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb
F configure 00a5b5c82147a576fa6e82d7c1b0d55c321d6d2c x F configure 00a5b5c82147a576fa6e82d7c1b0d55c321d6d2c x
F configure.in 6ccfd5fc80517f7cfe605a7fc7e0f62d962a233c F configure.in 6ccfd5fc80517f7cfe605a7fc7e0f62d962a233c
F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47 F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47
F src/build.c 56fd0763b19fa5aa3bdeb4acb4566b17305428a8 F src/build.c 6c7b4b79ed4c2caeb33dd66c1e3c3d6e062f0d60
F src/dbbe.c ab05293e89525041eaab8b4aca10516db3648792 F src/dbbe.c ab05293e89525041eaab8b4aca10516db3648792
F src/dbbe.h bedeb3a0985bb584458e7849fb59927e99e751e6 F src/dbbe.h bedeb3a0985bb584458e7849fb59927e99e751e6
F src/main.c 25cce7bce0eb3ba10bada7c05f4b38dc6dbbc86f F src/main.c 25cce7bce0eb3ba10bada7c05f4b38dc6dbbc86f
@ -21,9 +21,11 @@ F src/vdbe.c 80132b6bb9a744d1990a1c16666d54baaff2dbc3
F src/vdbe.h e721ad308f2e6ca805cebc4dd0a196ce4419d030 F src/vdbe.h e721ad308f2e6ca805cebc4dd0a196ce4419d030
F src/where.c 67ffea57920e16b33c580e9a9b9855b3ec9dea7b F src/where.c 67ffea57920e16b33c580e9a9b9855b3ec9dea7b
F test/all.test 66a8a5b8291a472157944edcdce51a320ebd1f35 F test/all.test 66a8a5b8291a472157944edcdce51a320ebd1f35
F test/delete.test bfa5a1d39b07a28f1e6c22044d78108ded6e60e7
F test/index.test 37cd05c590469d72c5a9299b510eb6bea00ada28 F test/index.test 37cd05c590469d72c5a9299b510eb6bea00ada28
F test/insert.test e9a927aa60ff34bb04143a38e5628cc3074457b4
F test/table.test 7eea7cd2a055b694fb1ba6b5de83ed7d78870b61 F test/table.test 7eea7cd2a055b694fb1ba6b5de83ed7d78870b61
F test/tester.tcl 0c260d6e56ba5ba69fbddef130638562e79bb2a3 F test/tester.tcl 70d25b7ced0a958bc377c72399b3dc6bf6a2d09e
F tool/gdbmdump.c 529e67c78d920606ba196326ea55b57b75fcc82b F tool/gdbmdump.c 529e67c78d920606ba196326ea55b57b75fcc82b
F tool/lemon.c cff35578b3c4d1491021b6418016639ebe21b1a5 F tool/lemon.c cff35578b3c4d1491021b6418016639ebe21b1a5
F tool/lempar.c a1eec94d6eacc12332368660ec65f3b248853833 F tool/lempar.c a1eec94d6eacc12332368660ec65f3b248853833
@ -33,7 +35,7 @@ F tool/renumberOps.awk 6d067177ad5f8d711b79577b462da9b3634bd0a9
F www/c_interface.tcl f875864edf7974157d1c257ca08de854660882a5 F www/c_interface.tcl f875864edf7974157d1c257ca08de854660882a5
F www/index.tcl 2466d1b2e26c6f354b0acedee12025309a216799 F www/index.tcl 2466d1b2e26c6f354b0acedee12025309a216799
F www/sqlite.tcl 947e067bcc347dc767af4c1a6e5a8d47d8404aa3 F www/sqlite.tcl 947e067bcc347dc767af4c1a6e5a8d47d8404aa3
P 84333008b70a11006053938f95bb048f7ee4f655 P 1c1d9c0d4ad91cf0b077f4fff82499dcafae36d7
R d7d842b04a2ca13987a8e3488e7d9871 R 3873d46fc99cb65f2b72af28e1592d68
U drh U drh
Z 7242b994245d2109ffa13546f2d68c6d Z eb44043639c5eea1b0351d3c17d1a099

View File

@ -1 +1 @@
1c1d9c0d4ad91cf0b077f4fff82499dcafae36d7 9818723ee127bc535e79f6876546cc027b4999e6

View File

@ -24,7 +24,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** when syntax rules are reduced. ** when syntax rules are reduced.
** **
** $Id: build.c,v 1.3 2000/05/29 23:30:51 drh Exp $ ** $Id: build.c,v 1.4 2000/05/30 00:51:27 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -770,7 +770,7 @@ void sqliteInsert(
sprintf(zNum1,"%d", pList->nExpr); sprintf(zNum1,"%d", pList->nExpr);
sprintf(zNum2,"%d", pTab->nCol); sprintf(zNum2,"%d", pTab->nCol);
sqliteSetString(&pParse->zErrMsg, "table ", pTab->zName, sqliteSetString(&pParse->zErrMsg, "table ", pTab->zName,
" has ", zNum2, " columns but only ", " has ", zNum2, " columns but ",
zNum1, " values were supplied", 0); zNum1, " values were supplied", 0);
pParse->nErr++; pParse->nErr++;
goto insert_cleanup; goto insert_cleanup;
@ -779,7 +779,7 @@ void sqliteInsert(
char zNum1[30]; char zNum1[30];
char zNum2[30]; char zNum2[30];
sprintf(zNum1,"%d", pList->nExpr); sprintf(zNum1,"%d", pList->nExpr);
sprintf(zNum2,"%d", pTab->nCol); sprintf(zNum2,"%d", pField->nId);
sqliteSetString(&pParse->zErrMsg, zNum1, " values for ", sqliteSetString(&pParse->zErrMsg, zNum1, " values for ",
zNum2, " columns", 0); zNum2, " columns", 0);
pParse->nErr++; pParse->nErr++;
@ -1173,8 +1173,8 @@ void sqliteDeleteFrom(
for(i=0; i<pTabList->nId; i++){ for(i=0; i<pTabList->nId; i++){
pTabList->a[i].pTab = sqliteFindTable(pParse->db, pTabList->a[i].zName); pTabList->a[i].pTab = sqliteFindTable(pParse->db, pTabList->a[i].zName);
if( pTabList->a[i].pTab==0 ){ if( pTabList->a[i].pTab==0 ){
sqliteSetString(&pParse->zErrMsg, "unknown table \"", sqliteSetString(&pParse->zErrMsg, "no such table: ",
pTabList->a[i].zName, "\"", 0); pTabList->a[i].zName, 0);
pParse->nErr++; pParse->nErr++;
goto delete_from_cleanup; goto delete_from_cleanup;
} }

47
test/delete.test Normal file
View File

@ -0,0 +1,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

101
test/insert.test Normal file
View File

@ -0,0 +1,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

View File

@ -23,7 +23,7 @@
# This file implements some common TCL routines used for regression # This file implements some common TCL routines used for regression
# testing the SQLite library # testing the SQLite library
# #
# $Id: tester.tcl,v 1.2 2000/05/29 23:48:23 drh Exp $ # $Id: tester.tcl,v 1.3 2000/05/30 00:51:27 drh Exp $
# Create a test database # Create a test database
# #
@ -83,8 +83,7 @@ proc finish_test {} {
proc execsql {sql} { proc execsql {sql} {
set result {} set result {}
db eval $sql data { db eval $sql data {
foreach f [lsort [array names data]] { foreach f $data(*) {
if {$f=="*"} continue
lappend result $data($f) lappend result $data($f)
} }
} }