diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pager.c | 14 | ||||
-rw-r--r-- | src/test1.c | 5 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/pager.c b/src/pager.c index 239232e51..d1b5779d4 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.206 2005/05/22 20:30:39 drh Exp $ +** @(#) $Id: pager.c,v 1.207 2005/06/07 02:12:30 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -1539,8 +1539,15 @@ void sqlite3pager_set_safety_level(Pager *pPager, int level){ #endif /* -** Open a temporary file. Write the name of the file into zName -** (zName must be at least SQLITE_TEMPNAME_SIZE bytes long.) Write +** The following global variable is incremented whenever the library +** attempts to open a temporary file. This information is used for +** testing and analysis only. +*/ +int sqlite3_opentemp_count = 0; + +/* +** Open a temporary file. Write the name of the file into zFile +** (zFile must be at least SQLITE_TEMPNAME_SIZE bytes long.) Write ** the file descriptor into *fd. Return SQLITE_OK on success or some ** other error code if we fail. ** @@ -1550,6 +1557,7 @@ void sqlite3pager_set_safety_level(Pager *pPager, int level){ static int sqlite3pager_opentemp(char *zFile, OsFile *fd){ int cnt = 8; int rc; + sqlite3_opentemp_count++; /* Used for testing and analysis only */ do{ cnt--; sqlite3OsTempFileName(zFile); diff --git a/src/test1.c b/src/test1.c index 6764e57d8..695a34e87 100644 --- a/src/test1.c +++ b/src/test1.c @@ -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.141 2005/06/06 17:54:56 drh Exp $ +** $Id: test1.c,v 1.142 2005/06/07 02:12:30 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -3074,6 +3074,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ int i; extern int sqlite3_os_trace; extern int sqlite3_sync_count, sqlite3_fullsync_count; + extern int sqlite3_opentemp_count; for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){ @@ -3095,6 +3096,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ (char*)&sqlite3_current_time, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_os_trace", (char*)&sqlite3_os_trace, TCL_LINK_INT); + Tcl_LinkVar(interp, "sqlite_opentemp_count", + (char*)&sqlite3_opentemp_count, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_static_bind_value", (char*)&sqlite_static_bind_value, TCL_LINK_STRING); Tcl_LinkVar(interp, "sqlite_temp_directory", |