| OLD | NEW | 
 | (Empty) | 
|   1 /* |  | 
|   2 ** 2007 May 05 |  | 
|   3 ** |  | 
|   4 ** The author disclaims copyright to this source code.  In place of |  | 
|   5 ** a legal notice, here is a blessing: |  | 
|   6 ** |  | 
|   7 **    May you do good and not evil. |  | 
|   8 **    May you find forgiveness for yourself and forgive others. |  | 
|   9 **    May you share freely, never taking more than you give. |  | 
|  10 ** |  | 
|  11 ************************************************************************* |  | 
|  12 ** Code for testing the btree.c module in SQLite.  This code |  | 
|  13 ** is not included in the SQLite library.  It is used for automated |  | 
|  14 ** testing of the SQLite library. |  | 
|  15 ** |  | 
|  16 ** $Id: test_btree.c,v 1.9 2009/07/09 02:48:24 shane Exp $ |  | 
|  17 */ |  | 
|  18 #include "btreeInt.h" |  | 
|  19 #include <tcl.h> |  | 
|  20  |  | 
|  21 /* |  | 
|  22 ** Usage: sqlite3_shared_cache_report |  | 
|  23 ** |  | 
|  24 ** Return a list of file that are shared and the number of |  | 
|  25 ** references to each file. |  | 
|  26 */ |  | 
|  27 int sqlite3BtreeSharedCacheReport( |  | 
|  28   void * clientData, |  | 
|  29   Tcl_Interp *interp, |  | 
|  30   int objc, |  | 
|  31   Tcl_Obj *CONST objv[] |  | 
|  32 ){ |  | 
|  33 #ifndef SQLITE_OMIT_SHARED_CACHE |  | 
|  34   extern BtShared *sqlite3SharedCacheList; |  | 
|  35   BtShared *pBt; |  | 
|  36   Tcl_Obj *pRet = Tcl_NewObj(); |  | 
|  37   for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){ |  | 
|  38     const char *zFile = sqlite3PagerFilename(pBt->pPager); |  | 
|  39     Tcl_ListObjAppendElement(interp, pRet, Tcl_NewStringObj(zFile, -1)); |  | 
|  40     Tcl_ListObjAppendElement(interp, pRet, Tcl_NewIntObj(pBt->nRef)); |  | 
|  41   } |  | 
|  42   Tcl_SetObjResult(interp, pRet); |  | 
|  43 #endif |  | 
|  44   return TCL_OK; |  | 
|  45 } |  | 
|  46  |  | 
|  47 /* |  | 
|  48 ** Print debugging information about all cursors to standard output. |  | 
|  49 */ |  | 
|  50 void sqlite3BtreeCursorList(Btree *p){ |  | 
|  51 #ifdef SQLITE_DEBUG |  | 
|  52   BtCursor *pCur; |  | 
|  53   BtShared *pBt = p->pBt; |  | 
|  54   for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){ |  | 
|  55     MemPage *pPage = pCur->apPage[pCur->iPage]; |  | 
|  56     char *zMode = pCur->wrFlag ? "rw" : "ro"; |  | 
|  57     sqlite3DebugPrintf("CURSOR %p rooted at %4d(%s) currently at %d.%d%s\n", |  | 
|  58        pCur, pCur->pgnoRoot, zMode, |  | 
|  59        pPage ? pPage->pgno : 0, pCur->aiIdx[pCur->iPage], |  | 
|  60        (pCur->eState==CURSOR_VALID) ? "" : " eof" |  | 
|  61     ); |  | 
|  62   } |  | 
|  63 #endif |  | 
|  64 } |  | 
| OLD | NEW |