]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Additional test coverage improvements. Test coverage now stands at 98.73%. (CVS...
authordrh <drh@noemail.net>
Sat, 19 Jan 2008 23:50:26 +0000 (23:50 +0000)
committerdrh <drh@noemail.net>
Sat, 19 Jan 2008 23:50:26 +0000 (23:50 +0000)
FossilOrigin-Name: 010f7b780cb9c8f21af9ce810494fbd2be98a13f

14 files changed:
manifest
manifest.uuid
src/btree.c
src/expr.c
src/func.c
src/test1.c
src/test3.c
src/vdbe.c
test/btree.test
test/capi3c.test
test/enc3.test
test/ioerr3.test
test/malloc.test
test/misc3.test

index b3e40c6d3f2fc27ad7a073ad13d398d3ffb8b1de..86cc20b013b9206abadd40aeb9ef2d2eed2a51a4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Miscellaneous\scode\ssimplifications\sand\scleanup\sand\stest\scoverage\nenhancements.\s(CVS\s4730)
-D 2008-01-19T20:11:26
+C Additional\stest\scoverage\simprovements.\s\sTest\scoverage\snow\sstands\sat\s98.73%.\s(CVS\s4731)
+D 2008-01-19T23:50:26
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -83,7 +83,7 @@ F src/analyze.c ac17da1f9c804aabf709a1afff12ed35fc215104
 F src/attach.c f7a34eb0f0e01db5fbfd8acb12109f87aed8159d
 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
 F src/btmutex.c 5d39da37c9d1282f3c6f9967afae6a34ee36b7ff
-F src/btree.c 5164b32950cfd41f2c5c31e8ff82c4a499918aef
+F src/btree.c a3125bd53a4112f2f259af858ef2eff63e397c9b
 F src/btree.h 19dcf5ad23c17b98855da548e9a8e3eb4429d5eb
 F src/btreeInt.h 1c5a9da165718ef7de81e35ce9ab5d9ba9283f76
 F src/build.c 27a3be10a7186515915ac73c40667dc55beacbac
@@ -92,8 +92,8 @@ F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
 F src/date.c 8ce763c68143b1e8fb6f79dcfc8b801853c97017
 F src/delete.c 739ccbab8fa7478762bded5c9cc67f16a4d09dbe
 F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
-F src/expr.c 9ac9177466b17b57e814f0beabc9e7bba88f8e38
-F src/func.c 996071cf0af9d967e58b69fce1909555059ebc7d
+F src/expr.c 07318c7e5e3062e2d33314f72819ea420b210dc1
+F src/func.c a7f44eaca16faec54d50756168f1665958b16f25
 F src/hash.c 45a7005aac044b6c86bd7e49c44bc15d30006d6c
 F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
 F src/insert.c 969b543eedaeb3ec4cd52cd6931db94da67388c3
@@ -140,9 +140,9 @@ F src/sqliteInt.h 9c3384439e402016037115ad143ed0c3adbd1c93
 F src/sqliteLimit.h ee4430f88f69bf63527967bb35ca52af7b0ccb1e
 F src/table.c 1aeb9eab57b4235db86fe15a35dec76fb445a9c4
 F src/tclsqlite.c 9923abeffc9b3d7dad58e92b319661521f60debf
-F src/test1.c cf222abaa6de1919bfd0c8ede4d280e4e368302b
+F src/test1.c 157f46f5945840dd89b959b8e72cc3410a075ed9
 F src/test2.c 77b34303883b9d722c65a6879bb0163a400e3789
-F src/test3.c df62cd5c971dc1ae0be0a1842f9df3390934e7a6
+F src/test3.c 6b49ddb0946907a07210998810807ace51be00a5
 F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
 F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
 F src/test6.c 8944b6482be3a54505c4f14339392448e4cabe66
@@ -168,7 +168,7 @@ F src/update.c 31edd9c9764e80753930bd5f9b43e0edb404636f
 F src/utf.c ef4b7d83bae533b76c3e1bf635b113fdad86a736
 F src/util.c deda8c5a400530e1c27c03619cc4cd1a06fc5281
 F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0
-F src/vdbe.c 65a3ad903f1c7a0f6e557fdc7671c3cb2d70fa12
+F src/vdbe.c 7d193674c491c28b670194862e108c976f5bf3ae
 F src/vdbe.h 58a7d931ffb704e034b2a725981cfa5bd406fad9
 F src/vdbeInt.h 835e6f0337ce89d705ef9a162338788808adc4b7
 F src/vdbeapi.c cb8c427a3ab646490c83204a98e94eff03ee2e89
@@ -208,7 +208,7 @@ F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
 F test/bind.test 261fd1603613e7f877a516d29f281c9d8c2ecf52
 F test/bindxfer.test b9a57f66dbd317feeefa28bd65b6576f1592ee98
 F test/blob.test 28c3b25150684ee3d108bb78cfb67a472deef2f0
-F test/btree.test eef24f3dd52b5b268321ae5aacfe30d3baca4e84
+F test/btree.test 41c328449887a4a532650db28cf346556ff70d4e
 F test/btree2.test 4b56a2a4a4f84d68c77aef271223a713bf5ebafc
 F test/btree4.test 3797b4305694c7af6828675b0f4b1424b8ca30e4
 F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2
@@ -221,7 +221,7 @@ F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9
 F test/capi2.test cc64df7560a96f848f919ea2926c60acf639684b
 F test/capi3.test 432fabf9c6402ed8ff1ae291e01f0e04b64df3ea
 F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
-F test/capi3c.test 0b089837ee65a17dd73ea171c4dee5d7ea79dabb
+F test/capi3c.test 7bcff27698351b6fbe45be5ebae95c1d2a1f4b1a
 F test/cast.test ce8f14fc80f70b30ed984480cc0d8914a459e8f9
 F test/check.test 024ed399600b799160378cf9d9f436bdf5dfd184
 F test/collate1.test e3eaa48c21e150814be1a7b852d2a8af24458d04
@@ -258,7 +258,7 @@ F test/diskfull.test 34ef53e88372c5b5e488ad1581514559a224c2b1
 F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
 F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
-F test/enc3.test 9331988b9d72decec96995c90637e87b00d747a5
+F test/enc3.test adb01b50ca1084658437eb68987969e8fa409276
 F test/exclusive.test ebaf72ce9ff8f7ab3a09bf8f58fd65393dfff386
 F test/exclusive2.test d13bf66753dca46e61241d35d36ab7c868b0d313
 F test/exclusive3.test 0e49c35b7e7cb8e7280b4ce3f0359d30b207d2ff
@@ -343,7 +343,7 @@ F test/intpkey.test 537669fd535f62632ca64828e435b9e54e8d677f
 F test/io.test 80a7a7f1a2792e037d447b03e8c22ee1f6eaf339
 F test/ioerr.test 5382046b2ef19b9084652e7d2d1e82ab33c0deda
 F test/ioerr2.test e3d52c40f43f9b61da9b38951a737e7b84ebae96
-F test/ioerr3.test 6f62c1b40365e87d58589def770f35b5d63539e1
+F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
 F test/join.test af0443185378b64878750aa1cf4b83c216f246b4
 F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324
 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
@@ -361,7 +361,7 @@ F test/lock2.test 018b846f6f3b3b695fad07e317b7988442b556f4
 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
 F test/lock4.test f358fa835dff485d462072eee991111f09e87441
 F test/main.test 05f585bb70c05caac3e047903b517cbb319ed204
-F test/malloc.test 760f346ba190fae9d5b6e495b844c9ce4db989cb
+F test/malloc.test 010b60540ce24d90c00bcd46762f06beb80f165d
 F test/malloc2.test bacb55551f6f4dc58c538589a8d3e29b127ef8d0
 F test/malloc3.test 5d3839afd98bff92b82d13405f41c96e77ac2a6b
 F test/malloc4.test f0e5e0f639f61e2776a6c3f5308f836b3ad8b3c7
@@ -386,7 +386,7 @@ F test/minmax2.test 33504c01a03bd99226144e4b03f7631a274d66e0
 F test/minmax3.test 5b89f055df7ed03334e96eec0efb804afb7de638
 F test/misc1.test 1b89c02c4a33b49dee4cd1d20d161aaaba719075
 F test/misc2.test 1ee89298de9c16b61454658b24999c403e86afe4
-F test/misc3.test 7952978e14c0a1b52c6fc983af0f4d785d57f065
+F test/misc3.test aea079f4c3d93e9962186f45c0ff0954310e6b11
 F test/misc4.test 91e8ed25c092c2bb4e0bb01864631e2930f8d7de
 F test/misc5.test b0b4b7e0dd5d40335c8e849e5738d11a40bddc7c
 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
@@ -607,7 +607,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P d9ebe9d78c558af050c44ac4437ce0ef8193a4a8
-R 94e60cf83c5be7070b2e0c99c104b013
+P af129b6d158cc90ce9752dd6383c1de47f7b3e43
+R 29177cb746663a31c6843d98589f65e8
 U drh
-Z 37d21009eb42b23cbb42db5cde98321f
+Z 52f8bb1305af66e6799c302ba2f646a8
index fe3ace84f0f72df0fe01167dcef3c171f2ca5019..3fcb0ec431fa80d5d829a6f1ad0ed40a935af0cc 100644 (file)
@@ -1 +1 @@
-af129b6d158cc90ce9752dd6383c1de47f7b3e43
\ No newline at end of file
+010f7b780cb9c8f21af9ce810494fbd2be98a13f
\ No newline at end of file
index 7734de4e3ba9a4aa907592bad9841c3d0bdddb2a..e57dfb3bb34d8c8c9a503800835f962c61367776 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.436 2008/01/02 11:50:51 danielk1977 Exp $
+** $Id: btree.c,v 1.437 2008/01/19 23:50:26 drh Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -1747,12 +1747,15 @@ static void unlockBtreeIfUnused(BtShared *pBt){
   assert( sqlite3_mutex_held(pBt->mutex) );
   if( pBt->inTransaction==TRANS_NONE && pBt->pCursor==0 && pBt->pPage1!=0 ){
     if( sqlite3PagerRefcount(pBt->pPager)>=1 ){
+      assert( pBt->pPage1->aData );
+#if 0
       if( pBt->pPage1->aData==0 ){
         MemPage *pPage = pBt->pPage1;
         pPage->aData = sqlite3PagerGetData(pPage->pDbPage);
         pPage->pBt = pBt;
         pPage->pgno = 1;
       }
+#endif
       releasePage(pBt->pPage1);
     }
     pBt->pPage1 = 0;
index 01574f2c9903c0c30e69fba8f7f5438181c67b8e..7cd0134ae32fc2cb511159c1dc38fe8249f044f2 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.350 2008/01/18 14:08:24 drh Exp $
+** $Id: expr.c,v 1.351 2008/01/19 23:50:26 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1227,23 +1227,16 @@ static int lookupName(
   ** more matches.  Either way, we have an error.
   */
   if( cnt!=1 ){
-    char *z = 0;
-    char *zErr;
-    zErr = cnt==0 ? "no such column: %s" : "ambiguous column name: %s";
+    const char *zErr;
+    zErr = cnt==0 ? "no such column" : "ambiguous column name";
     if( zDb ){
-      sqlite3SetString(&z, zDb, ".", zTab, ".", zCol, (char*)0);
+      sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol);
     }else if( zTab ){
-      sqlite3SetString(&z, zTab, ".", zCol, (char*)0);
+      sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol);
     }else{
-      z = sqlite3StrDup(zCol);
-    }
-    if( z ){
-      sqlite3ErrorMsg(pParse, zErr, z);
-      sqlite3_free(z);
-      pTopNC->nErr++;
-    }else{
-      db->mallocFailed = 1;
+      sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
     }
+    pTopNC->nErr++;
   }
 
   /* If a column from a table in pSrcList is referenced, then record
@@ -2422,9 +2415,7 @@ int sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){
 
 /*
 ** Generate code that evalutes the given expression and puts the result
-** in register target.  If target==-1, then allocate a temporary register
-** in which to store the result.  In either case, return the register
-** number where the result is stored.
+** in register target.
 **
 ** Also make a copy of the expression results into another "cache" register
 ** and modify the expression so that the next time it is evaluated,
@@ -2438,14 +2429,11 @@ int sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){
   Vdbe *v = pParse->pVdbe;
   int inReg;
   inReg = sqlite3ExprCode(pParse, pExpr, target);
+  assert( target>0 );
   if( pExpr->op!=TK_REGISTER ){  
     int iMem;
-    if( target<0 ){
-      iMem = inReg;
-    }else{
-      iMem = ++pParse->nMem;
-      sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);
-    }
+    iMem = ++pParse->nMem;
+    sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);
     pExpr->iTable = iMem;
     pExpr->op = TK_REGISTER;
   }
index 68f750b1246a92ea8fe96ae490cece58236ce906..fdacedad60f6ce90311d3738fc9967a8ee4a144c 100644 (file)
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.181 2007/12/13 21:54:11 drh Exp $
+** $Id: func.c,v 1.182 2008/01/19 23:50:26 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1150,7 +1150,7 @@ static void test_auxdata(
       if( zAux ){
         zRet[i*2] = '1';
         if( strcmp(zAux, z) ){
-          sqlite3_result_error(pCtx, "Auxilary data corruption", -1);
+          sqlite3_result_error(pCtx, "auxdata corruption", -1);
           return;
         }
       }else {
index 018593bee7f1366323f96cb86046ab6594c74aac..8431770c703cde00eb445e0d099b5c3130d1ff2a 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.283 2008/01/19 20:11:26 drh Exp $
+** $Id: test1.c,v 1.284 2008/01/19 23:50:26 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -2374,6 +2374,10 @@ static void test_function_utf16be(
   pVal = sqlite3ValueNew(0);
   sqlite3ValueSetStr(pVal, -1, Tcl_GetStringResult(interp), 
       SQLITE_UTF8, SQLITE_STATIC);
+  sqlite3_result_text16(pCtx, sqlite3_value_text16le(pVal),
+      -1, SQLITE_TRANSIENT);
+  sqlite3_result_text16be(pCtx, sqlite3_value_text16le(pVal),
+      -1, SQLITE_TRANSIENT);
   sqlite3_result_text16le(pCtx, sqlite3_value_text16le(pVal),
       -1, SQLITE_TRANSIENT);
   sqlite3ValueFree(pVal);
index 4bf3f136906c4a3e0ee0622893fb577698126539..a0bbf575b68e2e063e5eca2830ab8701549700be 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test3.c,v 1.88 2007/12/07 18:55:29 drh Exp $
+** $Id: test3.c,v 1.89 2008/01/19 23:50:26 drh Exp $
 */
 #include "sqliteInt.h"
 #include "btreeInt.h"
@@ -606,7 +606,7 @@ static int btree_pager_ref_dump(
     return TCL_ERROR;
   }
   pBt = sqlite3TextToPtr(argv[1]);
-#ifdef SQLITE_DEBUG
+#ifdef SQLITE_TEST
   sqlite3BtreeEnter(pBt);
   sqlite3PagerRefdump(sqlite3BtreePager(pBt));
   sqlite3BtreeLeave(pBt);
index 9f606a045ab58d6e93b55a7ffe0176f020e27276..f86877e52253b3f791c5843829685011b5400f02 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.701 2008/01/19 20:11:26 drh Exp $
+** $Id: vdbe.c,v 1.702 2008/01/19 23:50:26 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -3364,8 +3364,8 @@ case OP_ResetCount: {
 ** It is just copied onto the P2 register exactly as 
 ** it is found in the database file.
 **
-** If the cursor is not pointing to a valid row, a NULL value is
-** written into P2.
+** If the P1 cursor must be pointing to a valid row (not a NULL row)
+** of a real table, not a pseudo-table.
 */
 /* Opcode: RowKey P1 P2 * * *
 **
@@ -3374,13 +3374,14 @@ case OP_ResetCount: {
 ** The key is copied onto the P3 register exactly as 
 ** it is found in the database file.
 **
-** If the cursor is not pointing to a valid row, a NULL is
-** written into P2.
+** If the P1 cursor must be pointing to a valid row (not a NULL row)
+** of a real table, not a pseudo-table.
 */
 case OP_RowKey:             /* out2-prerelease */
 case OP_RowData: {          /* out2-prerelease */
   int i = pOp->p1;
   Cursor *pC;
+  BtCursor *pCrsr;
   u32 n;
 
   /* Note that RowKey and RowData are really exactly the same instruction */
@@ -3389,48 +3390,41 @@ case OP_RowData: {          /* out2-prerelease */
   assert( pC->isTable || pOp->opcode==OP_RowKey );
   assert( pC->isIndex || pOp->opcode==OP_RowData );
   assert( pC!=0 );
-  if( pC->nullRow ){
-    pOut->flags = MEM_Null;
-  }else if( pC->pCursor!=0 ){
-    BtCursor *pCrsr = pC->pCursor;
-    rc = sqlite3VdbeCursorMoveto(pC);
-    if( rc ) goto abort_due_to_error;
-    if( pC->isIndex ){
-      i64 n64;
-      assert( !pC->isTable );
-      sqlite3BtreeKeySize(pCrsr, &n64);
-      if( n64>SQLITE_MAX_LENGTH ){
-        goto too_big;
-      }
-      n = n64;
-    }else{
-      sqlite3BtreeDataSize(pCrsr, &n);
+  assert( pC->nullRow==0 );
+  assert( pC->pseudoTable==0 );
+  assert( pC->pCursor!=0 );
+  pCrsr = pC->pCursor;
+  rc = sqlite3VdbeCursorMoveto(pC);
+  if( rc ) goto abort_due_to_error;
+  if( pC->isIndex ){
+    i64 n64;
+    assert( !pC->isTable );
+    sqlite3BtreeKeySize(pCrsr, &n64);
+    if( n64>SQLITE_MAX_LENGTH ){
+      goto too_big;
     }
+    n = n64;
+  }else{
+    sqlite3BtreeDataSize(pCrsr, &n);
     if( n>SQLITE_MAX_LENGTH ){
       goto too_big;
     }
-    pOut->n = n;
-    if( n<=NBFS ){
-      pOut->flags = MEM_Blob | MEM_Short;
-      pOut->z = pOut->zShort;
-    }else{
-      char *z = sqlite3_malloc( n );
-      if( z==0 ) goto no_mem;
-      pOut->flags = MEM_Blob | MEM_Dyn;
-      pOut->xDel = 0;
-      pOut->z = z;
-    }
-    if( pC->isIndex ){
-      rc = sqlite3BtreeKey(pCrsr, 0, n, pOut->z);
-    }else{
-      rc = sqlite3BtreeData(pCrsr, 0, n, pOut->z);
-    }
+  }
+  pOut->n = n;
+  if( n<=NBFS ){
+    pOut->flags = MEM_Blob | MEM_Short;
+    pOut->z = pOut->zShort;
   }else{
-    assert( pC->pseudoTable );
-    pOut->n = pC->nData;
-    assert( pC->nData<=SQLITE_MAX_LENGTH );
-    pOut->z = pC->pData;
-    pOut->flags = MEM_Blob|MEM_Ephem;
+    char *z = sqlite3_malloc( n );
+    if( z==0 ) goto no_mem;
+    pOut->flags = MEM_Blob | MEM_Dyn;
+    pOut->xDel = 0;
+    pOut->z = z;
+  }
+  if( pC->isIndex ){
+    rc = sqlite3BtreeKey(pCrsr, 0, n, pOut->z);
+  }else{
+    rc = sqlite3BtreeData(pCrsr, 0, n, pOut->z);
   }
   pOut->enc = SQLITE_UTF8;  /* In case the blob is ever cast to text */
   UPDATE_MAX_BLOBSIZE(pOut);
@@ -4502,23 +4496,17 @@ case OP_VFilter: {   /* jump */
 */
 case OP_VRowid: {             /* out2-prerelease */
   const sqlite3_module *pModule;
-
+  sqlite_int64 iRow;
   Cursor *pCur = p->apCsr[pOp->p1];
+
   assert( pCur->pVtabCursor );
   pModule = pCur->pVtabCursor->pVtab->pModule;
-  if( pModule->xRowid==0 ){
-    sqlite3SetString(&p->zErrMsg, "Unsupported module operation: xRowid", 0);
-    rc = SQLITE_ERROR;
-  } else {
-    sqlite_int64 iRow;
-
-    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
-    rc = pModule->xRowid(pCur->pVtabCursor, &iRow);
-    if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
-    pOut->flags = MEM_Int;
-    pOut->u.i = iRow;
-  }
-
+  assert( pModule->xRowid );
+  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
+  rc = pModule->xRowid(pCur->pVtabCursor, &iRow);
+  if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
+  pOut->flags = MEM_Int;
+  pOut->u.i = iRow;
   break;
 }
 #endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -4532,41 +4520,36 @@ case OP_VRowid: {             /* out2-prerelease */
 */
 case OP_VColumn: {
   const sqlite3_module *pModule;
+  Mem *pDest;
+  sqlite3_context sContext;
 
   Cursor *pCur = p->apCsr[pOp->p1];
   assert( pCur->pVtabCursor );
   pModule = pCur->pVtabCursor->pVtab->pModule;
-  if( pModule->xColumn==0 ){
-    sqlite3SetString(&p->zErrMsg, "Unsupported module operation: xColumn", 0);
-    rc = SQLITE_ERROR;
-  } else {
-    Mem *pDest;
-    sqlite3_context sContext;
-    memset(&sContext, 0, sizeof(sContext));
-    sContext.s.flags = MEM_Null;
-    sContext.s.db = db;
-    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
-    rc = pModule->xColumn(pCur->pVtabCursor, &sContext, pOp->p2);
+  assert( pModule->xColumn );
+  memset(&sContext, 0, sizeof(sContext));
+  sContext.s.flags = MEM_Null;
+  sContext.s.db = db;
+  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
+  rc = pModule->xColumn(pCur->pVtabCursor, &sContext, pOp->p2);
 
-    /* Copy the result of the function to the P3 register. We
-    ** do this regardless of whether or not an error occured to ensure any
-    ** dynamic allocation in sContext.s (a Mem struct) is  released.
-    */
-    sqlite3VdbeChangeEncoding(&sContext.s, encoding);
-    assert( pOp->p3>0 && pOp->p3<=p->nMem );
-    pDest = &p->aMem[pOp->p3];
-    REGISTER_TRACE(pOp->p3, pDest);
-    sqlite3VdbeMemMove(pDest, &sContext.s);
-    UPDATE_MAX_BLOBSIZE(pDest);
-
-    if( sqlite3SafetyOn(db) ){
-      goto abort_due_to_misuse;
-    }
-    if( sqlite3VdbeMemTooBig(pDest) ){
-      goto too_big;
-    }
+  /* Copy the result of the function to the P3 register. We
+  ** do this regardless of whether or not an error occured to ensure any
+  ** dynamic allocation in sContext.s (a Mem struct) is  released.
+  */
+  sqlite3VdbeChangeEncoding(&sContext.s, encoding);
+  assert( pOp->p3>0 && pOp->p3<=p->nMem );
+  pDest = &p->aMem[pOp->p3];
+  REGISTER_TRACE(pOp->p3, pDest);
+  sqlite3VdbeMemMove(pDest, &sContext.s);
+  UPDATE_MAX_BLOBSIZE(pDest);
+
+  if( sqlite3SafetyOn(db) ){
+    goto abort_due_to_misuse;
+  }
+  if( sqlite3VdbeMemTooBig(pDest) ){
+    goto too_big;
   }
-  
   break;
 }
 #endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -4585,31 +4568,27 @@ case OP_VNext: {   /* jump */
   Cursor *pCur = p->apCsr[pOp->p1];
   assert( pCur->pVtabCursor );
   pModule = pCur->pVtabCursor->pVtab->pModule;
-  if( pModule->xNext==0 ){
-    sqlite3SetString(&p->zErrMsg, "Unsupported module operation: xNext", 0);
-    rc = SQLITE_ERROR;
-  } else {
-    /* Invoke the xNext() method of the module. There is no way for the
-    ** underlying implementation to return an error if one occurs during
-    ** xNext(). Instead, if an error occurs, true is returned (indicating that 
-    ** data is available) and the error code returned when xColumn or
-    ** some other method is next invoked on the save virtual table cursor.
-    */
-    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
-    p->inVtabMethod = 1;
-    rc = pModule->xNext(pCur->pVtabCursor);
-    p->inVtabMethod = 0;
-    if( rc==SQLITE_OK ){
-      res = pModule->xEof(pCur->pVtabCursor);
-    }
-    if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
+  assert( pModule->xNext );
 
-    if( !res ){
-      /* If there is data, jump to P2 */
-      pc = pOp->p2 - 1;
-    }
+  /* Invoke the xNext() method of the module. There is no way for the
+  ** underlying implementation to return an error if one occurs during
+  ** xNext(). Instead, if an error occurs, true is returned (indicating that 
+  ** data is available) and the error code returned when xColumn or
+  ** some other method is next invoked on the save virtual table cursor.
+  */
+  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
+  p->inVtabMethod = 1;
+  rc = pModule->xNext(pCur->pVtabCursor);
+  p->inVtabMethod = 0;
+  if( rc==SQLITE_OK ){
+    res = pModule->xEof(pCur->pVtabCursor);
   }
+  if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
 
+  if( !res ){
+    /* If there is data, jump to P2 */
+    pc = pOp->p2 - 1;
+  }
   break;
 }
 #endif /* SQLITE_OMIT_VIRTUALTABLE */
index d8575d06bdb4a07a92f17c3c8c5faa9550b572e7..8c6da2d257053ffbd25046020ba5da2ad3b3e952 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is btree database backend
 #
-# $Id: btree.test,v 1.41 2007/09/06 22:19:15 drh Exp $
+# $Id: btree.test,v 1.42 2008/01/19 23:50:26 drh Exp $
 
 
 set testdir [file dirname $argv0]
@@ -554,7 +554,7 @@ btree_page_dump $::b1 2
 do_test btree-8.1.1 {
   lindex [btree_pager_stats $::b1] 1
 } {1}
-#btree_pager_ref_dump $::b1
+btree_pager_ref_dump $::b1
 do_test btree-8.2 {
   btree_move_to $::c1 2020
   string length [btree_data $::c1]
index 4cd4180bb1881d2203754c0ed36c5c040613b44d..6d7a6cc804b5090ccacb7ab8a630986ee53f2c4f 100644 (file)
@@ -13,7 +13,7 @@
 # This is a copy of the capi3.test file that has been adapted to
 # test the new sqlite3_prepare_v2 interface.
 #
-# $Id: capi3c.test,v 1.13 2007/12/13 21:54:11 drh Exp $
+# $Id: capi3c.test,v 1.14 2008/01/19 23:50:26 drh Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -1173,9 +1173,18 @@ do_test capi3c-19.4 {
   db eval {DROP TABLE t3}
   sqlite3_step $STMT
 } SQLITE_SCHEMA
+do_test capi3c-19.4.1 {
+  sqlite3_errmsg $DB
+} {no such table: t3}
 do_test capi3c-19.4.2 {
+  sqlite3_expired $STMT
+} 1
+do_test capi3c-19.4.3 {
   sqlite3_errmsg $DB
 } {no such table: t3}
+do_test capi3c-19.4.4 {
+  sqlite3_expired 0
+} 1
 do_test capi3c-19.5 {
   sqlite3_reset $STMT
   db eval {
@@ -1184,6 +1193,9 @@ do_test capi3c-19.5 {
   }
   sqlite3_step $STMT
 } SQLITE_ROW
+do_test capi3c-19.5.2 {
+  sqlite3_expired $STMT
+} 0
 do_test capi3c-19.6 {
   sqlite3_column_int $STMT 1
 } 2
index 64f580786c742dd6f4e2135ea9f546e3c6b7b561..7f7cb0df6b617f076419b2171ef63fff52b9414c 100644 (file)
@@ -13,7 +13,7 @@
 # The focus of this file is testing of the proper handling of conversions
 # to the native text representation.
 #
-# $Id: enc3.test,v 1.6 2007/05/10 21:14:03 drh Exp $
+# $Id: enc3.test,v 1.7 2008/01/19 23:50:26 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -77,5 +77,26 @@ ifcapable {bloblit && utf16} {
   } {1}
 }
 
+# Try to attach a database with a different encoding.
+#
+ifcapable {utf16} {
+  file delete -force test8.db test8.db-journal
+  sqlite3 dbaux test8.db
+  do_test enc3-3.1 {
+    dbaux eval {
+      PRAGMA encoding='utf8';
+      CREATE TABLE t1(x);
+      PRAGMA encoding
+    }
+  } {UTF-8}
+  do_test enc3-3.2 {
+    catchsql {
+      ATTACH 'test.db' AS utf16;
+      SELECT 1 FROM utf16.sqlite_master LIMIT 1;
+    } dbaux
+  } {1 {attached databases must use the same text encoding as main database}}
+  catch {dbaux close}
+  file delete -force test8.db test8.db-journal
+}
 
 finish_test
index 70e484042578d5fa5303d60f4a961b26cfe89620..4598cbffe9754515e93ed0595b55fed8eeb7d64d 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this file is testing for correct handling of I/O errors
 # in conjunction with very small soft-heap-limit values.
 #
-# $Id: ioerr3.test,v 1.1 2007/12/19 09:20:42 danielk1977 Exp $
+# $Id: ioerr3.test,v 1.2 2008/01/19 23:50:26 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -33,6 +33,10 @@ do_ioerr_test ioerr3-1 -sqlprep {
   execsql COMMIT
 }
 
+do_ioerr_test ioerr3-2 -sqlbody {
+  CREATE TEMP TABLE t1(x,y);
+}
+
 sqlite3_soft_heap_limit 0
 
 finish_test
index c169ca7a2dbbbba9a60e55868c2befd504bbb4a2..d2f51217186ecbe09938713ff9a8087f45bd2a96 100644 (file)
@@ -16,7 +16,7 @@
 # to see what happens in the library if a malloc were to really fail
 # due to an out-of-memory situation.
 #
-# $Id: malloc.test,v 1.54 2008/01/16 17:46:38 drh Exp $
+# $Id: malloc.test,v 1.55 2008/01/19 23:50:26 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -29,6 +29,14 @@ ifcapable !memdebug {
    return
 }
 
+# Do a couple of memory dumps just to exercise the memory dump logic
+# that that we can say that we have.
+#
+puts stderr "This is a test.  Ignore the error that follows:"
+sqlite3_memdebug_dump $testdir
+puts "Memory dump to file memdump.txt..."
+sqlite3_memdebug_dump memdump.txt
+
 source $testdir/malloc_common.tcl
 
 ifcapable bloblit&&subquery {
index 01d525af45c760e5b6f004e5e4182ab8eb135003..89881e4aa9ccb2b917fbaa3e83d69528b3e51cb9 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests for miscellanous features that were
 # left out of other test files.
 #
-# $Id: misc3.test,v 1.17 2008/01/19 20:11:26 drh Exp $
+# $Id: misc3.test,v 1.18 2008/01/19 23:50:26 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -262,7 +262,11 @@ ifcapable {explain} {
   # Do some additional EXPLAIN operations to exercise the displayP4 logic.
   do_test misc3-6.10 {
     set x [execsql {
-      CREATE TABLE ex1(a INTEGER, b TEXT DEFAULT "hello", c);
+      CREATE TABLE ex1(
+        a INTEGER DEFAULT 54321,
+        b TEXT DEFAULT "hello",
+        c REAL DEFAULT 3.1415926
+      );
       CREATE UNIQUE INDEX ex1i1 ON ex1(a);
       EXPLAIN REINDEX;
     }]