]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
New testfixture command: sqlite3_pager_refcounts. Returns a list of
authordrh <drh@noemail.net>
Thu, 5 Apr 2007 17:36:18 +0000 (17:36 +0000)
committerdrh <drh@noemail.net>
Thu, 5 Apr 2007 17:36:18 +0000 (17:36 +0000)
integers which is the pager refcount for each pager in the database. (CVS 3815)

FossilOrigin-Name: 7338e68e0fd9263236f12f8911cb8293747dd1a4

manifest
manifest.uuid
src/test1.c

index fff150beb124c06b7d11f25b312a6a66612155b2..a30817f038133e1318174640aa1f1c94929a8caf 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Always\struncate\sthe\spager\scache\swhen\struncating\sthe\sdatabase\sfile.\sAlso\sreorganize\sthe\scode\sto\scheck\sthe\schange-counter\safter\sfirst\sobtaining\sa\sshared\slock.\s(CVS\s3814)
-D 2007-04-05T17:15:53
+C New\stestfixture\scommand:\ssqlite3_pager_refcounts.\s\sReturns\sa\slist\sof\nintegers\swhich\sis\sthe\spager\srefcount\sfor\seach\spager\sin\sthe\sdatabase.\s(CVS\s3815)
+D 2007-04-05T17:36:19
 F Makefile.in 29fbf08ce0989973bfed0b5a052a6bdf3e60fd0a
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -101,7 +101,7 @@ F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890
 F src/sqliteInt.h f09f449f266f71b236844e540bfce10e455ba6ab
 F src/table.c 6d0da66dde26ee75614ed8f584a1996467088d06
 F src/tclsqlite.c a8d1166319db5d505b25ac6a9820162afe63fc8a
-F src/test1.c 018c5fa3d98ac4ef364f671ef3752b793585f2fe
+F src/test1.c 6021cbcede9bfab986ade678efa7226180f3edff
 F src/test2.c 24458b17ab2f3c90cbc1c8446bd7ffe69be62f88
 F src/test3.c 65f92247cf8592854e9bf5115b3fb711f8b33280
 F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25
@@ -450,7 +450,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 97c5159816e211d9c71aa68db7c5e01df535d6a4
-R 3fc0ad20eb98e5c7a10bce0fbefb439e
-U danielk1977
-Z 9f9e23b7682ec7bf9ad2d8fa486a39d9
+P 9dc4100eff71be579480ce7939c7da712d28f0ae
+R 1e9ee6a288a346a81a2a6440f57fab41
+U drh
+Z 64a2ccb10f8f58e5172c3a04cbfd5df5
index c6b6806c126be414181bffa36eefdeda915991c1..9c665c8682d078822507506d90676674fc5b0d94 100644 (file)
@@ -1 +1 @@
-9dc4100eff71be579480ce7939c7da712d28f0ae
\ No newline at end of file
+7338e68e0fd9263236f12f8911cb8293747dd1a4
\ No newline at end of file
index 60498f14da19b39c0c255ba7e9da69fe6a65cb9f..50442ff19cc9f5891fa0a7425e5893af065b2b6a 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.233 2007/04/02 12:29:01 danielk1977 Exp $
+** $Id: test1.c,v 1.234 2007/04/05 17:36:19 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -3750,6 +3750,44 @@ static int test_thread_cleanup(
 }
 
 
+/*
+** Usage:   sqlite3_pager_refcounts  DB
+**
+** Return a list of numbers when are the PagerRefcount for each
+** pager on each database.
+*/
+static int test_pager_refcounts(
+  void * clientData,
+  Tcl_Interp *interp,
+  int objc,
+  Tcl_Obj *CONST objv[]
+){
+  sqlite3 *db;
+  int i;
+  int v, *a;
+  Tcl_Obj *pResult;
+
+  if( objc!=2 ){
+    Tcl_AppendResult(interp, "wrong # args: should be \"",
+        Tcl_GetStringFromObj(objv[0], 0), " <STMT>", 0);
+    return TCL_ERROR;
+  }
+  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
+  pResult = Tcl_NewObj();
+  for(i=0; i<db->nDb; i++){
+    if( db->aDb[i].pBt==0 ){
+      v = -1;
+    }else{
+      a = sqlite3PagerStats(sqlite3BtreePager(db->aDb[i].pBt));
+      v = a[0];
+    }
+    Tcl_ListObjAppendElement(0, pResult, Tcl_NewIntObj(v));
+  }
+  Tcl_SetObjResult(interp, pResult);
+  return TCL_OK;
+}
+
+
 /*
 ** This routine sets entries in the global ::sqlite_options() array variable
 ** according to the compile-time configuration of the database.  Test
@@ -4202,6 +4240,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
      { "sqlite3_clear_tsd_memdebug",    test_clear_tsd_memdebug, 0},
      { "sqlite3_tsd_release",           test_tsd_release,        0},
      { "sqlite3_thread_cleanup",        test_thread_cleanup,     0},
+     { "sqlite3_pager_refcounts",       test_pager_refcounts,    0},
 
      { "sqlite3_load_extension",        test_load_extension,     0},
      { "sqlite3_enable_load_extension", test_enable_load,        0},