4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
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.
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.
17 #if defined(INCLUDE_SQLITE_TCL_H)
18 # include "sqlite_tcl.h"
24 ** Usage: sqlite3_shared_cache_report
26 ** Return a list of file that are shared and the number of
27 ** references to each file.
29 int SQLITE_TCLAPI
sqlite3BtreeSharedCacheReport(
35 #ifndef SQLITE_OMIT_SHARED_CACHE
36 extern BtShared
*sqlite3SharedCacheList
;
38 Tcl_Obj
*pRet
= Tcl_NewObj();
39 for(pBt
=GLOBAL(BtShared
*,sqlite3SharedCacheList
); pBt
; pBt
=pBt
->pNext
){
40 const char *zFile
= sqlite3PagerFilename(pBt
->pPager
, 1);
41 Tcl_ListObjAppendElement(interp
, pRet
, Tcl_NewStringObj(zFile
, -1));
42 Tcl_ListObjAppendElement(interp
, pRet
, Tcl_NewIntObj(pBt
->nRef
));
44 Tcl_SetObjResult(interp
, pRet
);
50 ** Print debugging information about all cursors to standard output.
52 void sqlite3BtreeCursorList(Btree
*p
){
55 BtShared
*pBt
= p
->pBt
;
56 for(pCur
=pBt
->pCursor
; pCur
; pCur
=pCur
->pNext
){
57 MemPage
*pPage
= pCur
->apPage
[pCur
->iPage
];
58 char *zMode
= (pCur
->curFlags
& BTCF_WriteFlag
) ? "rw" : "ro";
59 sqlite3DebugPrintf("CURSOR %p rooted at %4d(%s) currently at %d.%d%s\n",
60 pCur
, pCur
->pgnoRoot
, zMode
,
61 pPage
? pPage
->pgno
: 0, pCur
->aiIdx
[pCur
->iPage
],
62 (pCur
->eState
==CURSOR_VALID
) ? "" : " eof"