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

:-) (CVS 82)

FossilOrigin-Name: 33355b2d8d23b51e917961b7fb336bc1d454497f
This commit is contained in:
drh
2000-06-08 16:26:24 +00:00
parent 4cfa793437
commit c837e70996
9 changed files with 167 additions and 34 deletions

View File

@ -1,5 +1,5 @@
C :-)\s(CVS\s81) C :-)\s(CVS\s82)
D 2000-06-08T15:10:47 D 2000-06-08T16:26:24
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 17ba1ccf8d2d40c627796bba8f72952365d6d644 F Makefile.in 17ba1ccf8d2d40c627796bba8f72952365d6d644
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958 F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
@ -13,38 +13,38 @@ F src/delete.c c267b93f7ccb5493b677fa18201880267c699aa8
F src/expr.c 5790665132658362f1416755cc4060215c781e90 F src/expr.c 5790665132658362f1416755cc4060215c781e90
F src/insert.c ac4edfff474589c00b2490f206317dc5822122e5 F src/insert.c ac4edfff474589c00b2490f206317dc5822122e5
F src/main.c e3297835b8e38ca726ac73f2c2bdb7cf08103197 F src/main.c e3297835b8e38ca726ac73f2c2bdb7cf08103197
F src/parse.y 389687d20f2ac914205ebbd58cef72b8c70322b2 F src/parse.y 03d246c261296ec85a72225ae3be999db1663e6d
F src/select.c 3a12d76074fa57d7c39c4436bdeb8d7e1eb6fdf4 F src/select.c 3a12d76074fa57d7c39c4436bdeb8d7e1eb6fdf4
F src/shell.c 3f4afc39a36e4824e8aa262623fd03568874799e F src/shell.c 3f4afc39a36e4824e8aa262623fd03568874799e
F src/sqlite.h 58da0a8590133777b741f9836beaef3d58f40268 F src/sqlite.h 58da0a8590133777b741f9836beaef3d58f40268
F src/sqliteInt.h 0aac58ed2e9fe46f24411e2e012fe85cd3457129 F src/sqliteInt.h 0aac58ed2e9fe46f24411e2e012fe85cd3457129
F src/tclsqlite.c 9f358618ae803bedf4fb96da5154fd45023bc1f7 F src/tclsqlite.c 9f358618ae803bedf4fb96da5154fd45023bc1f7
F src/tokenize.c cb9eacd12548ee1ae7089eb3177b38851d7f0a1f F src/tokenize.c 344754f81b55da5b19ea9504dfa16a9de68cd5ba
F src/update.c d8d90df714bac99c68446a0c49f3d957ca6fc3c8 F src/update.c d8d90df714bac99c68446a0c49f3d957ca6fc3c8
F src/util.c 38e4bb5edf6fa92e677698c45785bf73c69b9e9f F src/util.c 38e4bb5edf6fa92e677698c45785bf73c69b9e9f
F src/vdbe.c 8a92c95cf66ff67e8fc122d6892b08b0e7801d9c F src/vdbe.c cc5598c00935ec9ec349467487182ddce9c00bce
F src/vdbe.h 8f79f57c66ce1030f6371ff067b326d627a52c6d F src/vdbe.h 8f79f57c66ce1030f6371ff067b326d627a52c6d
F src/where.c c9b90e7672f4662a83ef9a27a193020d69fe034c F src/where.c c9b90e7672f4662a83ef9a27a193020d69fe034c
F test/all.test 0950c135cab7e60c07bd745ccfad1476211e5bd7 F test/all.test 0950c135cab7e60c07bd745ccfad1476211e5bd7
F test/copy.test b77a1214bd7756f2849d5c4fa6e715c0ff0c34eb F test/copy.test b77a1214bd7756f2849d5c4fa6e715c0ff0c34eb
F test/dbbe.test 0a8e4293cf816e590dcbb01be4cd4e8f7f95bdc8 F test/dbbe.test 0a8e4293cf816e590dcbb01be4cd4e8f7f95bdc8
F test/delete.test 30edd2c7484274fb2e7dbc4a1ac769bb330b322e F test/delete.test 30edd2c7484274fb2e7dbc4a1ac769bb330b322e
F test/expr.test 7d017f1aa64c981b161408a015424cd90592bc16 F test/expr.test 2209a2b06ea10ebb844b2c4ae08fe8345e5b87b2
F test/in.test 962a605b6a3a619214f84d1950dfc44fcf0d8b8f F test/in.test 962a605b6a3a619214f84d1950dfc44fcf0d8b8f
F test/index.test 9f99dca2d904b8de330863a978587f136e2df65a F test/index.test 9f99dca2d904b8de330863a978587f136e2df65a
F test/insert.test 66f4c3bd600fec8eb1e733b928cbe6fa885eff0c F test/insert.test 66f4c3bd600fec8eb1e733b928cbe6fa885eff0c
F test/insert2.test 732405e30331635af8d159fccabe835eea5cd0c6 F test/insert2.test 732405e30331635af8d159fccabe835eea5cd0c6
F test/main.test cf1e9035aca55da9ef6d3b73ab36c54b7514b83f F test/main.test a6c92ebc66b990b601a2f67bbd02404310a820e4
F test/select1.test 64703852af34c85bb31b0a74bd73b340e8267f42 F test/select1.test 64703852af34c85bb31b0a74bd73b340e8267f42
F test/select2.test 3cd3c0f9d67e98b1b54af5853679b4a111224410 F test/select2.test 3cd3c0f9d67e98b1b54af5853679b4a111224410
F test/select3.test a9234b8424b6c6d71de534f43b91ade9be68e9cc F test/select3.test a9234b8424b6c6d71de534f43b91ade9be68e9cc
F test/select4.test cb5374d7c87680e294ac749307459a5cc547609d F test/select4.test cb5374d7c87680e294ac749307459a5cc547609d
F test/select5.test b6f8b6bef467764a3edaea4e7cb9b0eb8f02ccd8 F test/select5.test 80ea257ce35e736c559bc6cd342361974e60a979
F test/sort.test d582086c4bb7df3fbf50aa72e69d7e235e9f8e31 F test/sort.test d582086c4bb7df3fbf50aa72e69d7e235e9f8e31
F test/subselect.test bf8b251a92fb091973c1c469ce499dc9648a41d5 F test/subselect.test bf8b251a92fb091973c1c469ce499dc9648a41d5
F test/table.test d3e01e4916a99ade7d8f1d534ee1b36d57c00490 F test/table.test d3e01e4916a99ade7d8f1d534ee1b36d57c00490
F test/tester.tcl 95b286791e6256bb6db0165f9342c70fff549a62 F test/tester.tcl 95b286791e6256bb6db0165f9342c70fff549a62
F test/update.test 69459302ea75cafac1479e60b0e36efb88123c0e F test/update.test b3f45984cd2b3aea6f24b6d77dc1e721ccaba244
F test/vacuum.test 8becf5cfeb897108b35cdd996793e7f1df2f28fd F test/vacuum.test 8becf5cfeb897108b35cdd996793e7f1df2f28fd
F tool/gdbmdump.c 529e67c78d920606ba196326ea55b57b75fcc82b F tool/gdbmdump.c 529e67c78d920606ba196326ea55b57b75fcc82b
F tool/lemon.c 1f0e96515c12e9e413f5b8fdebc79ddcf18ddc9d F tool/lemon.c 1f0e96515c12e9e413f5b8fdebc79ddcf18ddc9d
@ -57,7 +57,7 @@ F www/c_interface.tcl 9ac800854272db5fe439e07b7435b243a5422293
F www/changes.tcl 04e66b4257589ff78a7e1de93e9dda4725fb03d6 F www/changes.tcl 04e66b4257589ff78a7e1de93e9dda4725fb03d6
F www/index.tcl 52e29a4eeda8d59e91af43c61fef177c5f2ffd53 F www/index.tcl 52e29a4eeda8d59e91af43c61fef177c5f2ffd53
F www/sqlite.tcl 2f933ce18cffd34a0a020a82435ab937137970fd F www/sqlite.tcl 2f933ce18cffd34a0a020a82435ab937137970fd
P bf98cf82a73c54c4eced04994bb1a019844dfc03 P 61c381e7e6c85619b7b494417956fc209c5b7b84
R 147a3f5a92c9643c1c974e90b0fb5f44 R f79443a31154f60b0063b7fad1afe1ae
U drh U drh
Z 583fb9f51c189b28ce13ee596d8aedf2 Z a7a98045f3e2dce83769476787f9e43e

View File

@ -1 +1 @@
61c381e7e6c85619b7b494417956fc209c5b7b84 33355b2d8d23b51e917961b7fb336bc1d454497f

View File

@ -26,14 +26,13 @@
** the parser. Lemon will also generate a header file containing ** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens. ** numeric codes for all of the tokens.
** **
** @(#) $Id: parse.y,v 1.18 2000/06/08 15:10:47 drh Exp $ ** @(#) $Id: parse.y,v 1.19 2000/06/08 16:26:24 drh Exp $
*/ */
%token_prefix TK_ %token_prefix TK_
%token_type {Token} %token_type {Token}
%extra_argument {Parse *pParse} %extra_argument {Parse *pParse}
%syntax_error { %syntax_error {
sqliteSetNString(&pParse->zErrMsg,"syntax error near \"",0,TOKEN.z,TOKEN.n, sqliteSetString(&pParse->zErrMsg,"syntax error",0);
"\"", 1, 0);
pParse->sErrToken = TOKEN; pParse->sErrToken = TOKEN;
} }
%name sqliteParser %name sqliteParser

View File

@ -27,7 +27,7 @@
** individual tokens and sends those tokens one-by-one over to the ** individual tokens and sends those tokens one-by-one over to the
** parser for analysis. ** parser for analysis.
** **
** $Id: tokenize.c,v 1.10 2000/06/08 13:36:40 drh Exp $ ** $Id: tokenize.c,v 1.11 2000/06/08 16:26:24 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@ -211,7 +211,7 @@ int sqliteGetToken(const char *z, int *tokenType){
case '!': { case '!': {
if( z[1]!='=' ){ if( z[1]!='=' ){
*tokenType = TK_ILLEGAL; *tokenType = TK_ILLEGAL;
return 1; return 2;
}else{ }else{
*tokenType = TK_NE; *tokenType = TK_NE;
return 2; return 2;
@ -245,23 +245,23 @@ int sqliteGetToken(const char *z, int *tokenType){
} }
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': { case '5': case '6': case '7': case '8': case '9': {
*tokenType = TK_INTEGER;
for(i=1; z[i] && isdigit(z[i]); i++){} for(i=1; z[i] && isdigit(z[i]); i++){}
if( z[i]=='.' ){ if( z[i]=='.' ){
i++; i++;
while( z[i] && isdigit(z[i]) ){ i++; } while( z[i] && isdigit(z[i]) ){ i++; }
if( (z[i]=='e' || z[i]=='E') && *tokenType = TK_FLOAT;
}
if( (z[i]=='e' || z[i]=='E') &&
( isdigit(z[i+1]) ( isdigit(z[i+1])
|| ((z[i+1]=='+' || z[i+1]=='-') && isdigit(z[i+2])) || ((z[i+1]=='+' || z[i+1]=='-') && isdigit(z[i+2]))
) )
){ ){
i += 2; i += 2;
while( z[i] && isdigit(z[i]) ){ i++; } while( z[i] && isdigit(z[i]) ){ i++; }
}
*tokenType = TK_FLOAT; *tokenType = TK_FLOAT;
}else if( z[0]=='.' ){ }else if( z[0]=='.' ){
*tokenType = TK_FLOAT; *tokenType = TK_FLOAT;
}else{
*tokenType = TK_INTEGER;
} }
return i; return i;
} }
@ -363,8 +363,8 @@ int sqliteRunParser(Parse *pParse, char *zSql, char **pzErrMsg){
break; break;
} }
case TK_ILLEGAL: case TK_ILLEGAL:
sqliteSetNString(pzErrMsg, "illegal token: \"", -1, sqliteSetNString(pzErrMsg, "unrecognized token: \"", -1,
pParse->sLastToken.z, pParse->sLastToken.n, 0); pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, 0);
nErr++; nErr++;
break; break;
default: default:

View File

@ -41,7 +41,7 @@
** But other routines are also provided to help in building up ** But other routines are also provided to help in building up
** a program instruction by instruction. ** a program instruction by instruction.
** **
** $Id: vdbe.c,v 1.29 2000/06/08 15:10:48 drh Exp $ ** $Id: vdbe.c,v 1.30 2000/06/08 16:26:25 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <unistd.h> #include <unistd.h>
@ -426,7 +426,7 @@ static int AggInsert(Agg *p, char *zKey){
AggElem *pElem; AggElem *pElem;
int i; int i;
if( p->nHash <= p->nElem*2 ){ if( p->nHash <= p->nElem*2 ){
AggRehash(p, p->nElem*2 + 103); AggRehash(p, p->nElem*2 + 19);
} }
if( p->nHash==0 ) return 1; if( p->nHash==0 ) return 1;
pElem = sqliteMalloc( sizeof(AggElem) + strlen(zKey) + 1 + pElem = sqliteMalloc( sizeof(AggElem) + strlen(zKey) + 1 +

View File

@ -23,7 +23,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing expressions. # focus of this file is testing expressions.
# #
# $Id: expr.test,v 1.6 2000/06/07 15:23:56 drh Exp $ # $Id: expr.test,v 1.7 2000/06/08 16:26:25 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -144,6 +144,7 @@ test_expr expr-5.5b {t1='ac', t2='A%C'} {t1 LIKE t2} 1
test_expr expr-5.6 {t1='abxyzzyc', t2='A%C'} {t1 LIKE t2} 1 test_expr expr-5.6 {t1='abxyzzyc', t2='A%C'} {t1 LIKE t2} 1
test_expr expr-5.7 {t1='abxyzzy', t2='A%C'} {t1 LIKE t2} 0 test_expr expr-5.7 {t1='abxyzzy', t2='A%C'} {t1 LIKE t2} 0
test_expr expr-5.8 {t1='abxyzzycx', t2='A%C'} {t1 LIKE t2} 0 test_expr expr-5.8 {t1='abxyzzycx', t2='A%C'} {t1 LIKE t2} 0
test_expr expr-5.8b {t1='abxyzzycy', t2='A%CX'} {t1 LIKE t2} 0
test_expr expr-5.9 {t1='abc', t2='A%_C'} {t1 LIKE t2} 1 test_expr expr-5.9 {t1='abc', t2='A%_C'} {t1 LIKE t2} 1
test_expr expr-5.9b {t1='ac', t2='A%_C'} {t1 LIKE t2} 0 test_expr expr-5.9b {t1='ac', t2='A%_C'} {t1 LIKE t2} 0
test_expr expr-5.10 {t1='abxyzzyc', t2='A%_C'} {t1 LIKE t2} 1 test_expr expr-5.10 {t1='abxyzzyc', t2='A%_C'} {t1 LIKE t2} 1
@ -161,7 +162,20 @@ test_expr expr-6.8 {t1='abxyzzyc', t2='a*c'} {t1 GLOB t2} 1
test_expr expr-6.9 {t1='abxyzzy', t2='a*c'} {t1 GLOB t2} 0 test_expr expr-6.9 {t1='abxyzzy', t2='a*c'} {t1 GLOB t2} 0
test_expr expr-6.10 {t1='abxyzzycx', t2='a*c'} {t1 GLOB t2} 0 test_expr expr-6.10 {t1='abxyzzycx', t2='a*c'} {t1 GLOB t2} 0
test_expr expr-6.11 {t1='abc', t2='xyz'} {t1 NOT GLOB t2} 1 test_expr expr-6.11 {t1='abc', t2='xyz'} {t1 NOT GLOB t2} 1
test_expr expr-6.12 {t1='abc', t2='a?c'} {t1 NOT GLOB t2} 0 test_expr expr-6.12 {t1='abc', t2='abc'} {t1 NOT GLOB t2} 0
test_expr expr-6.13 {t1='abc', t2='a[bx]c'} {t1 GLOB t2} 1
test_expr expr-6.14 {t1='abc', t2='a[cx]c'} {t1 GLOB t2} 0
test_expr expr-6.15 {t1='abc', t2='a[a-d]c'} {t1 GLOB t2} 1
test_expr expr-6.16 {t1='abc', t2='a[^a-d]c'} {t1 GLOB t2} 0
test_expr expr-6.17 {t1='abc', t2='a[A-Dc]c'} {t1 GLOB t2} 0
test_expr expr-6.18 {t1='abc', t2='a[^A-Dc]c'} {t1 GLOB t2} 1
test_expr expr-6.19 {t1='abc', t2='a[]b]c'} {t1 GLOB t2} 1
test_expr expr-6.20 {t1='abc', t2='a[^]b]c'} {t1 GLOB t2} 0
test_expr expr-6.21 {t1='abcdefg', t2='a*[de]g'} {t1 GLOB t2} 0
test_expr expr-6.22 {t1='abcdefg', t2='a*[^de]g'} {t1 GLOB t2} 1
test_expr expr-6.23 {t1='abcdefg', t2='a*?g'} {t1 GLOB t2} 1
test_expr expr-6.24 {t1='ac', t2='a*c'} {t1 GLOB t2} 1
test_expr expr-6.25 {t1='ac', t2='a*?c'} {t1 GLOB t2} 0
# The sqliteExprIfFalse and sqliteExprIfTrue routines are only # The sqliteExprIfFalse and sqliteExprIfTrue routines are only
# executed as part of a WHERE clause. Create a table suitable # executed as part of a WHERE clause. Create a table suitable

View File

@ -23,7 +23,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is exercising the code in main.c. # focus of this file is exercising the code in main.c.
# #
# $Id: main.test,v 1.1 2000/06/07 15:11:27 drh Exp $ # $Id: main.test,v 1.2 2000/06/08 16:26:25 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -62,4 +62,49 @@ do_test main-2.0 {
lappend v $msg lappend v $msg
} {0 {}} } {0 {}}
# Here are some tests for tokenize.c.
#
do_test main-3.1 {
catch {db close}
file delete -force testdb
sqlite db testdb
set v [catch {execsql {SELECT * from T1 where x!!5}} msg]
lappend v $msg
} {1 {unrecognized token: "!!"}}
do_test main-3.2 {
catch {db close}
file delete -force testdb
sqlite db testdb
set v [catch {execsql {SELECT * from T1 where ~x}} msg]
lappend v $msg
} {1 {unrecognized token: "~"}}
do_test main-3.3 {
catch {db close}
file delete -force testdb
sqlite db testdb
execsql {
create table T1(X REAL);
insert into T1 values(.5);
insert into T1 values(0.5e2);
insert into T1 values(0.5e-002);
insert into T1 values(5e-002);
insert into T1 values(-5.0e-2);
insert into T1 values(-5.1e-2);
insert into T1 values(.5e2);
insert into T1 values(.5E+02);
insert into T1 values(5E+02);
insert into T1 values(5.E+03);
select x*10 from T1 order by x*5;
}
} {-0.51 -0.5 0.05 0.5 5 500 500 500 5000 50000}
do_test main-3.4 {
set v [catch {execsql {create bogus}} msg]
lappend v $msg
} {1 {near "bogus": syntax error}}
do_test main-3.5 {
set v [catch {execsql {create}} msg]
lappend v $msg
} {1 {near "create": syntax error}}
finish_test finish_test

View File

@ -24,7 +24,7 @@
# focus of this file is testing aggregate functions and the # focus of this file is testing aggregate functions and the
# GROUP BY and HAVING clauses of SELECT statements. # GROUP BY and HAVING clauses of SELECT statements.
# #
# $Id: select5.test,v 1.2 2000/06/08 11:25:01 drh Exp $ # $Id: select5.test,v 1.3 2000/06/08 16:26:25 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -59,4 +59,53 @@ do_test select5-1.3 {
execsql {SELECT count(*), y FROM t1 GROUP BY y ORDER BY count(*), y} execsql {SELECT count(*), y FROM t1 GROUP BY y ORDER BY count(*), y}
} {1 9 1 10 2 8 4 7 8 6 15 5} } {1 9 1 10 2 8 4 7 8 6 15 5}
# Some error messages associated with aggregates and GROUP BY
#
do_test select5-2.1 {
set v [catch {execsql {
SELECT y, count(*) FROM t1 GROUP BY z ORDER BY y
}} msg]
lappend v $msg
} {1 {no such field: z}}
do_test select5-2.2 {
set v [catch {execsql {
SELECT y, count(*) FROM t1 GROUP BY z(y) ORDER BY y
}} msg]
lappend v $msg
} {1 {no such function: z}}
do_test select5-2.3 {
set v [catch {execsql {
SELECT y, count(*) FROM t1 GROUP BY y HAVING count(*)<3 ORDER BY y
}} msg]
lappend v $msg
} {0 {8 2 9 1 10 1}}
do_test select5-2.4 {
set v [catch {execsql {
SELECT y, count(*) FROM t1 GROUP BY y HAVING z(y)<3 ORDER BY y
}} msg]
lappend v $msg
} {1 {no such function: z}}
do_test select5-2.5 {
set v [catch {execsql {
SELECT y, count(*) FROM t1 GROUP BY y HAVING count(*)<z ORDER BY y
}} msg]
lappend v $msg
} {1 {no such field: z}}
# Get the Agg function to rehash in vdbe.c
#
do_test select5-3.1 {
execsql {
SELECT x, count(*), avg(y) FROM t1 GROUP BY x HAVING x<4 ORDER BY x
}
} {1 1 5 2 1 5 3 1 5}
# Run the AVG() function when the count is zero.
#
do_test select5-4.1 {
execsql {
SELECT avg(x) FROM t1 WHERE x>100
}
} {}
finish_test finish_test

View File

@ -23,7 +23,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the UPDATE statement. # focus of this file is testing the UPDATE statement.
# #
# $Id: update.test,v 1.1 2000/05/30 03:12:22 drh Exp $ # $Id: update.test,v 1.2 2000/06/08 16:26:25 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -110,6 +110,32 @@ do_test update-3.12 {
execsql {SELECT * FROM test1 WHERE f1=1025} execsql {SELECT * FROM test1 WHERE f1=1025}
} {1025 11} } {1025 11}
# Error messages
#
do_test update-4.1 {
set v [catch {execsql {
UPDATE test1 SET x=11 WHERE f1=1025
}} msg]
lappend v $msg
} {1 {no such field: x}}
do_test update-4.2 {
set v [catch {execsql {
UPDATE test1 SET f1=x(11) WHERE f1=1025
}} msg]
lappend v $msg
} {1 {no such function: x}}
do_test update-4.3 {
set v [catch {execsql {
UPDATE test1 SET f1=11 WHERE x=1025
}} msg]
lappend v $msg
} {1 {no such field: x}}
do_test update-4.4 {
set v [catch {execsql {
UPDATE test1 SET f1=11 WHERE x(f1)=1025
}} msg]
lappend v $msg
} {1 {no such function: x}}