| Index: third_party/sqlite/src/src/status.c
|
| diff --git a/third_party/sqlite/src/src/status.c b/third_party/sqlite/src/src/status.c
|
| index 69f92ff7c624ddb50e395d4459e8b6ca48c4310e..24dcad45724c39aa6fbbb6cc06197152d7dfd728 100644
|
| --- a/third_party/sqlite/src/src/status.c
|
| +++ b/third_party/sqlite/src/src/status.c
|
| @@ -158,7 +158,7 @@ int sqlite3_status64(
|
| return SQLITE_OK;
|
| }
|
| int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
|
| - sqlite3_int64 iCur, iHwtr;
|
| + sqlite3_int64 iCur = 0, iHwtr = 0;
|
| int rc;
|
| #ifdef SQLITE_ENABLE_API_ARMOR
|
| if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
|
| @@ -219,6 +219,7 @@ int sqlite3_db_status(
|
| ** by all pagers associated with the given database connection. The
|
| ** highwater mark is meaningless and is returned as zero.
|
| */
|
| + case SQLITE_DBSTATUS_CACHE_USED_SHARED:
|
| case SQLITE_DBSTATUS_CACHE_USED: {
|
| int totalUsed = 0;
|
| int i;
|
| @@ -227,7 +228,11 @@ int sqlite3_db_status(
|
| Btree *pBt = db->aDb[i].pBt;
|
| if( pBt ){
|
| Pager *pPager = sqlite3BtreePager(pBt);
|
| - totalUsed += sqlite3PagerMemUsed(pPager);
|
| + int nByte = sqlite3PagerMemUsed(pPager);
|
| + if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){
|
| + nByte = nByte / sqlite3BtreeConnectionCount(pBt);
|
| + }
|
| + totalUsed += nByte;
|
| }
|
| }
|
| sqlite3BtreeLeaveAll(db);
|
|
|