1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Improve coverage of expr.c and btree.c slightly. (CVS 2992)

FossilOrigin-Name: cc2e8e87cfd474b4dc6833ee0c38e2cd2dd3a494
This commit is contained in:
danielk1977
2006-01-23 05:50:58 +00:00
parent 6dc1d95dd8
commit 4b202ae2a5
5 changed files with 87 additions and 23 deletions

View File

@ -1,5 +1,5 @@
C Remove\svestiges\sof\sthe\solder\sTSD\scode\sfor\shandling\sOOM\sexceptions.\nPrepare\sfor\sthe\srelease\sof\s3.3.2.\s(CVS\s2991) C Improve\scoverage\sof\sexpr.c\sand\sbtree.c\sslightly.\s(CVS\s2992)
D 2006-01-23T00:04:54 D 2006-01-23T05:50:58
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -42,7 +42,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c 2f148728b53675266cd9e1a873fd702929d3f4ee F src/date.c 2f148728b53675266cd9e1a873fd702929d3f4ee
F src/delete.c d92db30012503e0b1db45ff95dd0efd7118eaae7 F src/delete.c d92db30012503e0b1db45ff95dd0efd7118eaae7
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
F src/expr.c c541c569906daf6225d1a21afe4cba5d430233cd F src/expr.c 62f044ebff77bd7f486e3f214a963f0bfffd5d1b
F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a
F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863 F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
@ -226,9 +226,9 @@ F test/select5.test 0b47058d3e916c1fc9fe81f44b438e02bade21ce
F test/select6.test 22f4b0c591b75464519ec5085b3385ac60698eb2 F test/select6.test 22f4b0c591b75464519ec5085b3385ac60698eb2
F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6 F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5 F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
F test/shared.test 9982a65ccf3f4eee844a19f3ab0bcd7a158a76e5 F test/shared.test 8f8bc93c23b45ec63e1b11b8f3d8d018af47a58b
F test/shared2.test 909fc0f0277684ed29cc1b36c8e159188aec7f28 F test/shared2.test 909fc0f0277684ed29cc1b36c8e159188aec7f28
F test/shared_err.test 32d43ebe6b2a43b27227cc2cd153f5bcf9f0e8ad F test/shared_err.test ceb93bac112bcb1a6e57f5da56feae953148a543
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797 F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2 F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 3e1e6affe256a950a81ad5939b628bafb8463b42 P a65e85f0e01f3bca5f4e78999c10db3916824b5b
R bc5b2ca65db1b6cb2127e17629a50b89 R 3297151c316e2b9323e59dbed5915963
U drh U danielk1977
Z 123ef0750be477d63bf6489bbd9d0613 Z 1bc72467bea30951a32409adca1d9341

View File

@ -1 +1 @@
a65e85f0e01f3bca5f4e78999c10db3916824b5b cc2e8e87cfd474b4dc6833ee0c38e2cd2dd3a494

View File

@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and ** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite. ** for generating VDBE code that evaluates expressions in SQLite.
** **
** $Id: expr.c,v 1.250 2006/01/18 16:51:35 danielk1977 Exp $ ** $Id: expr.c,v 1.251 2006/01/23 05:50:58 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@ -280,6 +280,7 @@ void sqlite3ExprSpan(Expr *pExpr, Token *pLeft, Token *pRight){
*/ */
Expr *sqlite3ExprFunction(ExprList *pList, Token *pToken){ Expr *sqlite3ExprFunction(ExprList *pList, Token *pToken){
Expr *pNew; Expr *pNew;
assert( pToken );
pNew = sqliteMalloc( sizeof(Expr) ); pNew = sqliteMalloc( sizeof(Expr) );
if( pNew==0 ){ if( pNew==0 ){
sqlite3ExprListDelete(pList); /* Avoid leaking memory when malloc fails */ sqlite3ExprListDelete(pList); /* Avoid leaking memory when malloc fails */
@ -287,12 +288,8 @@ Expr *sqlite3ExprFunction(ExprList *pList, Token *pToken){
} }
pNew->op = TK_FUNCTION; pNew->op = TK_FUNCTION;
pNew->pList = pList; pNew->pList = pList;
if( pToken ){ assert( pToken->dyn==0 );
assert( pToken->dyn==0 ); pNew->token = *pToken;
pNew->token = *pToken;
}else{
pNew->token.z = 0;
}
pNew->span = pNew->token; pNew->span = pNew->token;
return pNew; return pNew;
} }
@ -2085,10 +2082,8 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
*/ */
int sqlite3ExprCompare(Expr *pA, Expr *pB){ int sqlite3ExprCompare(Expr *pA, Expr *pB){
int i; int i;
if( pA==0 ){ if( pA==0||pB==0 ){
return pB==0; return pB==pA;
}else if( pB==0 ){
return 0;
} }
if( pA->op!=pB->op ) return 0; if( pA->op!=pB->op ) return 0;
if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 0; if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 0;

View File

@ -9,7 +9,7 @@
# #
#*********************************************************************** #***********************************************************************
# #
# $Id: shared.test,v 1.19 2006/01/19 08:43:32 danielk1977 Exp $ # $Id: shared.test,v 1.20 2006/01/23 05:50:58 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -63,6 +63,7 @@ incr av
# shared-8.*: Tests related to the text encoding of shared-cache databases. # shared-8.*: Tests related to the text encoding of shared-cache databases.
# shared-9.*: TEMP triggers and shared-cache databases. # shared-9.*: TEMP triggers and shared-cache databases.
# shared-10.*: Tests of sqlite3_close(). # shared-10.*: Tests of sqlite3_close().
# shared-11.*: Test transaction locking.
# #
do_test shared-$av.1.1 { do_test shared-$av.1.1 {
@ -787,6 +788,64 @@ do_test shared-$av.10.11 {
db3 close db3 close
} {} } {}
do_test shared-$av.11.1 {
file delete -force test.db
sqlite3 db test.db
sqlite3 db2 test.db
execsql {
CREATE TABLE abc(a, b, c);
CREATE TABLE abc2(a, b, c);
BEGIN;
INSERT INTO abc VALUES(1, 2, 3);
}
} {}
do_test shared-$av.11.2 {
catchsql {BEGIN;} db2
catchsql {SELECT * FROM abc;} db2
} {1 {database table is locked: abc}}
do_test shared-$av.11.3 {
catchsql {BEGIN} db2
} {1 {cannot start a transaction within a transaction}}
do_test shared-$av.11.4 {
catchsql {SELECT * FROM abc2;} db2
} {0 {}}
do_test shared-$av.11.5 {
catchsql {INSERT INTO abc2 VALUES(1, 2, 3);} db2
} {1 {database is locked}}
do_test shared-$av.11.6 {
catchsql {SELECT * FROM abc2}
} {0 {}}
do_test shared-$av.11.6 {
execsql {
ROLLBACK;
PRAGMA read_uncommitted = 1;
} db2
} {}
do_test shared-$av.11.7 {
execsql {
INSERT INTO abc2 VALUES(4, 5, 6);
INSERT INTO abc2 VALUES(7, 8, 9);
}
} {}
do_test shared-$av.11.8 {
set res [list]
breakpoint
db2 eval {
SELECT abc.a as I, abc2.a as II FROM abc, abc2;
} {
execsql {
DELETE FROM abc WHERE 1;
}
lappend res $I $II
}
set res
} {1 4 {} 7}
do_test shared-$av.11.11 {
db close
db2 close
} {}
} }
sqlite3_enable_shared_cache $::enable_shared_cache sqlite3_enable_shared_cache $::enable_shared_cache

View File

@ -13,7 +13,7 @@
# cache context. What happens to connection B if one connection A encounters # cache context. What happens to connection B if one connection A encounters
# an IO-error whilst reading or writing the file-system? # an IO-error whilst reading or writing the file-system?
# #
# $Id: shared_err.test,v 1.3 2006/01/21 12:08:55 danielk1977 Exp $ # $Id: shared_err.test,v 1.4 2006/01/23 05:50:58 danielk1977 Exp $
proc skip {args} {} proc skip {args} {}
@ -310,6 +310,16 @@ do_malloc_test 4 -tclprep {
db2 close db2 close
} }
do_malloc_test 5 -tclbody {
sqlite3 dbX test.db
sqlite3 dbY test.db
dbX close
dbY close
} -cleanup {
catch {dbX close}
catch {dbY close}
}
catch {db close} catch {db close}
sqlite3_enable_shared_cache $::enable_shared_cache sqlite3_enable_shared_cache $::enable_shared_cache
finish_test finish_test