-C Shuffle\ssome\sof\sthe\smutex\srelated\sdocumentation\sin\ssqlite.h.in\sto\smatch\sthe\snew\ssqlite3_mutex_methods\sbased\sAPI.\s(CVS\s5244)
-D 2008-06-19T08:51:24
+C Check\sin\sthe\smissing\sstatus.c\ssource\sfile.\s(CVS\s5245)
+D 2008-06-19T13:20:02
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/sqlite3ext.h faacd0e6a81aabee0861c6d7883c9172e74ef5b3
F src/sqliteInt.h 6dd55232e738a4dac23475cd4b0e444dff75c896
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
+F src/status.c 6cb10377992505bd69f1ca1d75c1240a65f25a58
F src/table.c 1fa8f8113ac9cbc09ae4801c6d2a7f0af82c5822
F src/tclsqlite.c 4dd9ee4cb44846ad9bcc4d0da8088c1e7d4b33d9
F src/test1.c e78c07d7f1db40593ab1e4aa321016184af0c7ad
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 565a530896b40790287eeaad709edd51980fbddf
-R 950854b62a7a587d35382e80a0549a75
-U danielk1977
-Z 2b8089afd328ee7a65250c0132b39dd9
+P 9cd7f8669a59c6096331229df2e2ad87e628abab
+R 2ae02cc3666590b0ae8cac03168cec93
+U drh
+Z dc8fb3a0d249f077cc181d199fa20d70
--- /dev/null
+/*
+** 2008 June 18
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This module implements the sqlite3_status() interface and related
+** functionality.
+**
+** $Id: status.c,v 1.1 2008/06/19 13:20:02 drh Exp $
+*/
+#include "sqliteInt.h"
+
+/*
+** Variables in which to record status information.
+*/
+static struct {
+ int nowValue[6]; /* Current value */
+ int mxValue[6]; /* Maximum value */
+} sqlite3Stat;
+
+
+/*
+** Reset the status records. This routine is called by
+** sqlite3_initialize().
+*/
+void sqlite3StatusReset(void){
+ memset(&sqlite3Stat, 0, sizeof(sqlite3Stat));
+}
+
+/*
+** Return the current value of a status parameter.
+*/
+int sqlite3StatusValue(int op){
+ assert( op>=0 && op<ArraySize(sqlite3Stat.nowValue) );
+ return sqlite3Stat.nowValue[op];
+}
+
+/*
+** Add N to the value of a status record. It is assumed that the
+** caller holds appropriate locks.
+*/
+void sqlite3StatusAdd(int op, int N){
+ assert( op>=0 && op<ArraySize(sqlite3Stat.nowValue) );
+ sqlite3Stat.nowValue[op] += N;
+ if( sqlite3Stat.nowValue[op]>sqlite3Stat.mxValue[op] ){
+ sqlite3Stat.mxValue[op] = sqlite3Stat.nowValue[op];
+ }
+}
+
+/*
+** Set the value of a status to X.
+*/
+void sqlite3StatusSet(int op, int X){
+ assert( op>=0 && op<ArraySize(sqlite3Stat.nowValue) );
+ sqlite3Stat.nowValue[op] = X;
+ if( sqlite3Stat.nowValue[op]>sqlite3Stat.mxValue[op] ){
+ sqlite3Stat.mxValue[op] = sqlite3Stat.nowValue[op];
+ }
+}
+
+/*
+** Query status information.
+**
+** This implementation assumes that reading or writing an aligned
+** 32-bit integer is an atomic operation. If that assumption is not true,
+** then this routine is not threadsafe.
+*/
+int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
+ if( op<0 || op>=ArraySize(sqlite3Stat.nowValue) ){
+ return SQLITE_MISUSE;
+ }
+ *pCurrent = sqlite3Stat.nowValue[op];
+ *pHighwater = sqlite3Stat.mxValue[op];
+ if( resetFlag ){
+ sqlite3Stat.mxValue[op] = sqlite3Stat.nowValue[op];
+ }
+ return SQLITE_OK;
+}