]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simplifications to vdbe.c to promote better test coverage. (CVS 6802)
authordrh <drh@noemail.net>
Tue, 23 Jun 2009 14:15:04 +0000 (14:15 +0000)
committerdrh <drh@noemail.net>
Tue, 23 Jun 2009 14:15:04 +0000 (14:15 +0000)
FossilOrigin-Name: 3ffc93d762b64fd84f47c4b6d68ab56b69ea98a9

manifest
manifest.uuid
src/vdbe.c
src/vdbeInt.h
src/vdbeaux.c

index c81e7be6176d6252fc3a185595a35f71e5d3a878..d246793f671394e94036958dadc40d4b550169fc 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\stest\sto\sverify\sthat\s#3929\sis\sfixed.\s(CVS\s6801)
-D 2009-06-23T11:53:09
+C Simplifications\sto\svdbe.c\sto\spromote\sbetter\stest\scoverage.\s(CVS\s6802)
+D 2009-06-23T14:15:04
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -203,11 +203,11 @@ F src/update.c 6ae6c26adff8dc34532d578f66e6cfde04b5d177
 F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff
 F src/util.c a7e981e032c3c9c0887d50d7e658a33cb355b43d
 F src/vacuum.c 0e14f371ea3326c6b8cfba257286d798cd20db59
-F src/vdbe.c c5a0a208432e4faf6590201ace57c7c873143089
+F src/vdbe.c 5337789f2b481281ec74e6fc0385cf544e074e2b
 F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a
-F src/vdbeInt.h 7823eac611229163c6a5df0e9e0d54ffcda527e7
+F src/vdbeInt.h 831c254a6eef237ef4664c8381a0137586567007
 F src/vdbeapi.c 73bd1d2c57b953bc688d1d8c84b24c2084c2aec7
-F src/vdbeaux.c 6f0e3680b7b235d7f012de84936f1b7c5320f0c3
+F src/vdbeaux.c 2801d0183c52e3739abae28b861b4415418e999a
 F src/vdbeblob.c c25d7e7bc6d5917feeb17270bd275fa771f26e5c
 F src/vdbemem.c d244e09b5ca8afc3e1cea3ccf0b1a3fa48926614
 F src/vtab.c 98fbffc5efe68d8107511dec0a650efc7daa9446
@@ -737,7 +737,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 47ec8749470af7cab9f3ef15effce1a7ba79a654
-R a22ed399ab7c6f7eec8f95fb89f627c5
-U danielk1977
-Z 77f7ae75a7f49b6f7f31cd38f6e68f1d
+P 16c1ae9bde895d39c4eaababbd1dbf9e3b9cb653
+R cecbd0804d9906b55a4bb7e736217764
+U drh
+Z 14ae8f5d7ec7181408185f0905513298
index 4e7ed8922f5ab04b84fd28a7635a085da7f91f1f..5e94a1a914f7da6d7d87aa4bbb520c5c6a9c02fe 100644 (file)
@@ -1 +1 @@
-16c1ae9bde895d39c4eaababbd1dbf9e3b9cb653
\ No newline at end of file
+3ffc93d762b64fd84f47c4b6d68ab56b69ea98a9
\ No newline at end of file
index a594001631e1ac9952d9444dded5b790de2588e4..0379131907234590cc54a48bec50806ddbaaa3bb 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.861 2009/06/22 19:05:41 drh Exp $
+** $Id: vdbe.c,v 1.862 2009/06/23 14:15:04 drh Exp $
 */
 #include "sqliteInt.h"
 #include "vdbeInt.h"
@@ -4248,7 +4248,7 @@ case OP_IdxRowid: {              /* out2-prerelease */
     assert( pC->deferredMoveto==0 );
     assert( pC->isTable==0 );
     if( !pC->nullRow ){
-      rc = sqlite3VdbeIdxRowid(pCrsr, &rowid);
+      rc = sqlite3VdbeIdxRowid(db, pCrsr, &rowid);
       if( rc!=SQLITE_OK ){
         goto abort_due_to_error;
       }
@@ -5319,9 +5319,7 @@ case OP_VRename: {
   pName = &p->aMem[pOp->p1];
   assert( pVtab->pModule->xRename );
   REGISTER_TRACE(pOp->p1, pName);
-
-  Stringify(pName, encoding);
-
+  assert( pName->flags & MEM_Str );
   if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
   sqlite3VtabLock(pVtab);
   rc = pVtab->pModule->xRename(pVtab, pName->z);
@@ -5372,10 +5370,7 @@ case OP_VUpdate: {
   pModule = (sqlite3_module *)pVtab->pModule;
   nArg = pOp->p2;
   assert( pOp->p4type==P4_VTAB );
-  if( pModule->xUpdate==0 ){
-    sqlite3SetString(&p->zErrMsg, db, "read-only table");
-    rc = SQLITE_ERROR;
-  }else{
+  if( ALWAYS(pModule->xUpdate) ){
     apArg = p->apArg;
     pX = &p->aMem[pOp->p3];
     for(i=0; i<nArg; i++){
@@ -5391,7 +5386,7 @@ case OP_VUpdate: {
     pVtab->zErrMsg = 0;
     sqlite3VtabUnlock(db, pVtab);
     if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
-    if( pOp->p1 && rc==SQLITE_OK ){
+    if( rc==SQLITE_OK && pOp->p1 ){
       assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) );
       db->lastRowid = rowid;
     }
@@ -5414,7 +5409,10 @@ case OP_Pagecount: {            /* out2-prerelease */
   p1 = pOp->p1; 
   pPager = sqlite3BtreePager(db->aDb[p1].pBt);
   rc = sqlite3PagerPagecount(pPager, &nPage);
-  if( rc==SQLITE_OK ){
+  /* OP_Pagecount is always called from within a read transaction.  The
+  ** page count has already been successfully read and cached.  So the
+  ** sqlite3PagerPagecount() call above cannot fail. */
+  if( ALWAYS(rc==SQLITE_OK) ){
     pOut->flags = MEM_Int;
     pOut->u.i = nPage;
   }
index 52b048ddca4e7b0e2f590f8244802e6816627eb6..e44e03a9994aad9ac1459a14f0e35f67aab10c05 100644 (file)
@@ -15,7 +15,7 @@
 ** 6000 lines long) it was split up into several smaller files and
 ** this header information was factored out.
 **
-** $Id: vdbeInt.h,v 1.173 2009/06/22 00:55:31 drh Exp $
+** $Id: vdbeInt.h,v 1.174 2009/06/23 14:15:04 drh Exp $
 */
 #ifndef _VDBEINT_H_
 #define _VDBEINT_H_
@@ -329,7 +329,7 @@ void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);
 
 int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
 int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*);
-int sqlite3VdbeIdxRowid(BtCursor *, i64 *);
+int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *);
 int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
 int sqlite3VdbeExec(Vdbe*);
 int sqlite3VdbeList(Vdbe*);
index 109fca2e50984a450f77efac1f30f553c30464f9..09260189cd3f3763b29c75e20f7da9162550dd1c 100644 (file)
@@ -14,7 +14,7 @@
 ** to version 2.8.7, all this code was combined into the vdbe.c source file.
 ** But that file was getting too big so this subroutines were split out.
 **
-** $Id: vdbeaux.c,v 1.463 2009/06/22 19:05:41 drh Exp $
+** $Id: vdbeaux.c,v 1.464 2009/06/23 14:15:04 drh Exp $
 */
 #include "sqliteInt.h"
 #include "vdbeInt.h"
@@ -2577,7 +2577,7 @@ int sqlite3VdbeRecordCompare(
 ** pCur might be pointing to text obtained from a corrupt database file.
 ** So the content cannot be trusted.  Do appropriate checks on the content.
 */
-int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
+int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
   i64 nCellKey = 0;
   int rc;
   u32 szHdr;        /* Size of the header */
@@ -2594,7 +2594,7 @@ int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
 
   /* Read in the complete content of the index entry */
   m.flags = 0;
-  m.db = 0;
+  m.db = db;
   m.zMalloc = 0;
   rc = sqlite3VdbeMemFromBtree(pCur, 0, (int)nCellKey, 1, &m);
   if( rc ){