From 6a179ea796e45d8079ced8facc4d05db1eb751fe Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 27 Jun 2004 21:31:39 +0000 Subject: [PATCH] Remove unused routines from vdbeaux.c. Improve test coverage. (CVS 1746) FossilOrigin-Name: 792b3c75e7764bab1473c0d6efc76f1164c943bf --- manifest | 18 +++++++-------- manifest.uuid | 2 +- src/vdbe.h | 6 +---- src/vdbeaux.c | 60 ------------------------------------------------- test/rowid.test | 19 ++++++++++++++-- test/sort.test | 46 ++++++++++++++++++++++++++++++++++++- 6 files changed, 73 insertions(+), 78 deletions(-) diff --git a/manifest b/manifest index c59d3256c0..7a840233ee 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sthe\shandling\sof\sMems\sinside\sof\svdbe.c.\s(CVS\s1745) -D 2004-06-27T01:56:33 +C Remove\sunused\sroutines\sfrom\svdbeaux.c.\s\sImprove\stest\scoverage.\s(CVS\s1746) +D 2004-06-27T21:31:40 F Makefile.in cb7a9889c38723f72b2506c4236ff30a05ff172b F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -74,10 +74,10 @@ F src/utf.c a8fb39c94ae4ef6606d5216b6f05d9b86f6901b2 F src/util.c 43d0289d49f43c66847ebbeddfb85a2a0d1ddd2d F src/vacuum.c 353c7f69dbeb6738434d81798465cc0698844640 F src/vdbe.c b750a731c90567b77ed6e0cd455ac868953d3a72 -F src/vdbe.h 2d87155e31e84bb00cdc48cc1ce6987a3a484250 +F src/vdbe.h 75b241c02431b9c0f16eaa9cdbb34146c6287f52 F src/vdbeInt.h d83fd7389838453d8392915c21f432014afc99cf F src/vdbeapi.c e92bda928f2fe93a9a77a62bd95642563bbcdea1 -F src/vdbeaux.c e7201e3f129439bc64d2ff79b54001adc2c95539 +F src/vdbeaux.c 8b6d2558d0f73e1d292544ace62ee530b632e06d F src/vdbemem.c e8ae1f56ad16d5b01119e8dc1d25e913e06c3128 F src/where.c 6507074d8ce3f78e7a4cd33f667f11e62020553e F test/all.test d591e074013248176402a16a0fb6fc82d241bad5 @@ -146,14 +146,14 @@ F test/printf.test 1eb584b7272d1abdfe117b2ef7cf3376ae8e4e06 F test/progress.test 7542a6ac7894a1b7730c1f9a27f3f8b9388a4d25 x F test/quick.test 4c0b3eabe2e0e606622d63d7d61ef6efb3ce156b F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d -F test/rowid.test 8845b4861341ef23f94e51f27702335d9c5dcd31 +F test/rowid.test b3d059f5c8d8874fa1c31030e0636f67405d20ea F test/select1.test 813a270ac7996b31ff228e8109cd2d1e8c3fa255 F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc F test/select3.test ab2e583154ee230fa4b46b06512775a38cd9d8b0 F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2 F test/select5.test 3f3f0f31e674fa61f8a3bdb6af1517dfae674081 F test/select6.test a9e31906e700e7c7592c4d0acfc022808f718baf -F test/sort.test dbd94673b05054e44ca3f08a80faa1e890ef06d8 +F test/sort.test 30fb9ea782a78da849a562d53233ec62d421bf61 F test/subselect.test f0fea8cf9f386d416d64d152e3c65f9116d0f50f F test/table.test b6d07f04c4157d1f2a37fb7febe36b250d468e31 F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede @@ -229,7 +229,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 0f9c0f0aa9188c46c65cb92203687f37884f685a -R 890a4b373e4b15aa9e98bea1cb54b3e0 +P ad65c6e24e15966d5fd15d60f81487ff97788da4 +R 7fb0a503afcd1983e7383e197a263d6b U drh -Z bd1af074bc92b88e71778888aba3c921 +Z 14da04ae7b5201e9ba94b52411af1fdc diff --git a/manifest.uuid b/manifest.uuid index 555b422f75..8ce20e972d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ad65c6e24e15966d5fd15d60f81487ff97788da4 \ No newline at end of file +792b3c75e7764bab1473c0d6efc76f1164c943bf \ No newline at end of file diff --git a/src/vdbe.h b/src/vdbe.h index 572b275d3d..6c11f22873 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -15,7 +15,7 @@ ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** -** $Id: vdbe.h,v 1.88 2004/06/21 08:18:59 danielk1977 Exp $ +** $Id: vdbe.h,v 1.89 2004/06/27 21:31:40 drh Exp $ */ #ifndef _SQLITE_VDBE_H_ #define _SQLITE_VDBE_H_ @@ -39,9 +39,6 @@ struct VdbeOp { int p2; /* Second parameter (often the jump destination) */ char *p3; /* Third parameter */ int p3type; /* P3_STATIC, P3_DYNAMIC or P3_POINTER */ -#ifndef NDEBUG - char *zComment; /* Comments explaining what this opcode does */ -#endif #ifdef VDBE_PROFILE int cnt; /* Number of times this instruction was executed */ long long cycles; /* Total time spend executing this instruction */ @@ -118,7 +115,6 @@ int sqlite3VdbeFinalize(Vdbe*); void sqlite3VdbeResolveLabel(Vdbe*, int); int sqlite3VdbeCurrentAddr(Vdbe*); void sqlite3VdbeTrace(Vdbe*,FILE*); -void sqlite3VdbeCompressSpace(Vdbe*,int); int sqlite3VdbeReset(Vdbe*); int sqliteVdbeSetVariables(Vdbe*,int,const char**); void sqlite3VdbeSetNumCols(Vdbe*,int); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index b7b73fd72d..3cfd6053d7 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -100,7 +100,6 @@ int sqlite3VdbeAddOp(Vdbe *p, int op, int p1, int p2){ pOp->p3 = 0; pOp->p3type = P3_NOTUSED; #ifndef NDEBUG - pOp->zComment = 0; if( sqlite3_vdbe_addop_trace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]); #endif return i; @@ -209,7 +208,6 @@ int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){ pOut->p3 = pIn->p3; pOut->p3type = pIn->p3 ? P3_STATIC : P3_NOTUSED; #ifndef NDEBUG - pOut->zComment = 0; if( sqlite3_vdbe_addop_trace ){ sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]); } @@ -333,56 +331,6 @@ void sqlite3VdbeDequoteP3(Vdbe *p, int addr){ sqlite3Dequote(pOp->p3); } -/* -** On the P3 argument of the given instruction, change all -** strings of whitespace characters into a single space and -** delete leading and trailing whitespace. -*/ -void sqlite3VdbeCompressSpace(Vdbe *p, int addr){ - unsigned char *z; - int i, j; - Op *pOp; - assert( p->magic==VDBE_MAGIC_INIT ); - if( p->aOp==0 || addr<0 || addr>=p->nOp ) return; - pOp = &p->aOp[addr]; - if( pOp->p3type==P3_STATIC ){ - pOp->p3 = sqliteStrDup(pOp->p3); - pOp->p3type = P3_DYNAMIC; - } - assert( pOp->p3type==P3_DYNAMIC ); - z = (unsigned char*)pOp->p3; - if( z==0 ) return; - i = j = 0; - while( isspace(z[i]) ){ i++; } - while( z[i] ){ - if( isspace(z[i]) ){ - z[j++] = ' '; - while( isspace(z[++i]) ){} - }else{ - z[j++] = z[i++]; - } - } - while( j>0 && isspace(z[j-1]) ){ j--; } - z[j] = 0; -} - -#ifndef NDEBUG -/* -** Add comment text to the most recently inserted opcode -*/ -void sqlite3VdbeAddComment(Vdbe *p, const char *zFormat, ...){ - va_list ap; - VdbeOp *pOp; - char *zText; - va_start(ap, zFormat); - zText = sqlite3_vmprintf(zFormat, ap); - va_end(ap); - pOp = &p->aOp[p->nOp-1]; - sqliteFree(pOp->zComment); - pOp->zComment = zText; -} -#endif - /* ** Search the current program starting at instruction addr for the given ** opcode and P2 value. Return the address plus 1 if found and 0 if not @@ -488,13 +436,8 @@ void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){ static const char *zFormat2 = "%4d %-13s %4d %4d %-20s -- %s\n"; if( pOut==0 ) pOut = stdout; zP3 = displayP3(pOp, zPtr, sizeof(zPtr)); -#ifdef NDEBUG fprintf(pOut, zFormat1, pc, sqlite3OpcodeNames[pOp->opcode], pOp->p1, pOp->p2, zP3); -#else - fprintf(pOut, pOp->zComment ? zFormat2 : zFormat1, - pc, sqlite3OpcodeNames[pOp->opcode], pOp->p1, pOp->p2, zP3,pOp->zComment); -#endif fflush(pOut); } #endif @@ -1377,9 +1320,6 @@ void sqlite3VdbeDelete(Vdbe *p){ sqlite3VdbeDeleteAuxData(pVdbeFunc, 0); sqliteFree(pVdbeFunc); } -#ifndef NDEBUG - sqliteFree(pOp->zComment); -#endif } for(i=0; inVar; i++){ sqlite3VdbeMemRelease(&p->apVar[i]); diff --git a/test/rowid.test b/test/rowid.test index cff09d0b9b..64dac527b3 100644 --- a/test/rowid.test +++ b/test/rowid.test @@ -12,7 +12,7 @@ # focus of this file is testing the magic ROWID column that is # found on all tables. # -# $Id: rowid.test,v 1.15 2004/06/19 00:16:31 drh Exp $ +# $Id: rowid.test,v 1.16 2004/06/27 21:31:40 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -631,6 +631,21 @@ do_test rowid-11.4 { execsql {SELECT rowid, a FROM t5 WHERE rowid<='abc'} } {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8} - +# Test the automatic generation of rowids when the table already contains +# a rowid with the maximum value. +# +do_test rowid-12.1 { + execsql { + CREATE TABLE t7(x INTEGER PRIMARY KEY, y); + INSERT INTO t7 VALUES(9223372036854775807,'a'); + SELECT y FROM t7; + } +} {a} +do_test rowid-12.2 { + execsql { + INSERT INTO t7 VALUES(NULL,'b'); + SELECT y FROM t7; + } +} {b a} finish_test diff --git a/test/sort.test b/test/sort.test index fe027ee812..0e8624107b 100644 --- a/test/sort.test +++ b/test/sort.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # -# $Id: sort.test,v 1.13 2004/06/09 09:55:20 danielk1977 Exp $ +# $Id: sort.test,v 1.14 2004/06/27 21:31:40 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -355,4 +355,48 @@ do_test sort-8.1 { } } {100 A1 100 A2} +# BLOBs should sort after TEXT +# +do_test sort-9.1 { + execsql { + CREATE TABLE t6(x, y); + INSERT INTO t6 VALUES(1,1); + INSERT INTO t6 VALUES(2,'1'); + INSERT INTO t6 VALUES(3,x'31'); + INSERT INTO t6 VALUES(4,NULL); + SELECT x FROM t6 ORDER BY y; + } +} {4 1 2 3} +do_test sort-9.2 { + execsql { + SELECT x FROM t6 ORDER BY y DESC; + } +} {3 2 1 4} +do_test sort-9.3 { + execsql { + SELECT x FROM t6 WHERE y<1 + } +} {} +do_test sort-9.4 { + execsql { + SELECT x FROM t6 WHERE y<'1' + } +} {1} +do_test sort-9.5 { + execsql { + SELECT x FROM t6 WHERE y1 + } +} {2 3} +do_test sort-9.7 { + execsql { + SELECT x FROM t6 WHERE y>'1' + } +} {3} + + finish_test