| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2008 June 18 | 2 ** 2008 June 18 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 ** *pCurrent gets an accurate estimate of the amount of memory used | 201 ** *pCurrent gets an accurate estimate of the amount of memory used |
| 202 ** to store all prepared statements. | 202 ** to store all prepared statements. |
| 203 ** *pHighwater is set to zero. | 203 ** *pHighwater is set to zero. |
| 204 */ | 204 */ |
| 205 case SQLITE_DBSTATUS_STMT_USED: { | 205 case SQLITE_DBSTATUS_STMT_USED: { |
| 206 struct Vdbe *pVdbe; /* Used to iterate through VMs */ | 206 struct Vdbe *pVdbe; /* Used to iterate through VMs */ |
| 207 int nByte = 0; /* Used to accumulate return value */ | 207 int nByte = 0; /* Used to accumulate return value */ |
| 208 | 208 |
| 209 db->pnBytesFreed = &nByte; | 209 db->pnBytesFreed = &nByte; |
| 210 for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){ | 210 for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){ |
| 211 sqlite3VdbeDeleteObject(db, pVdbe); | 211 sqlite3VdbeClearObject(db, pVdbe); |
| 212 sqlite3DbFree(db, pVdbe); |
| 212 } | 213 } |
| 213 db->pnBytesFreed = 0; | 214 db->pnBytesFreed = 0; |
| 214 | 215 |
| 215 *pHighwater = 0; | 216 *pHighwater = 0; /* IMP: R-64479-57858 */ |
| 216 *pCurrent = nByte; | 217 *pCurrent = nByte; |
| 217 | 218 |
| 218 break; | 219 break; |
| 219 } | 220 } |
| 220 | 221 |
| 222 /* |
| 223 ** Set *pCurrent to the total cache hits or misses encountered by all |
| 224 ** pagers the database handle is connected to. *pHighwater is always set |
| 225 ** to zero. |
| 226 */ |
| 227 case SQLITE_DBSTATUS_CACHE_HIT: |
| 228 case SQLITE_DBSTATUS_CACHE_MISS: |
| 229 case SQLITE_DBSTATUS_CACHE_WRITE:{ |
| 230 int i; |
| 231 int nRet = 0; |
| 232 assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 ); |
| 233 assert( SQLITE_DBSTATUS_CACHE_WRITE==SQLITE_DBSTATUS_CACHE_HIT+2 ); |
| 234 |
| 235 for(i=0; i<db->nDb; i++){ |
| 236 if( db->aDb[i].pBt ){ |
| 237 Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt); |
| 238 sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet); |
| 239 } |
| 240 } |
| 241 *pHighwater = 0; /* IMP: R-42420-56072 */ |
| 242 /* IMP: R-54100-20147 */ |
| 243 /* IMP: R-29431-39229 */ |
| 244 *pCurrent = nRet; |
| 245 break; |
| 246 } |
| 247 |
| 248 /* Set *pCurrent to non-zero if there are unresolved deferred foreign |
| 249 ** key constraints. Set *pCurrent to zero if all foreign key constraints |
| 250 ** have been satisfied. The *pHighwater is always set to zero. |
| 251 */ |
| 252 case SQLITE_DBSTATUS_DEFERRED_FKS: { |
| 253 *pHighwater = 0; /* IMP: R-11967-56545 */ |
| 254 *pCurrent = db->nDeferredImmCons>0 || db->nDeferredCons>0; |
| 255 break; |
| 256 } |
| 257 |
| 221 default: { | 258 default: { |
| 222 rc = SQLITE_ERROR; | 259 rc = SQLITE_ERROR; |
| 223 } | 260 } |
| 224 } | 261 } |
| 225 sqlite3_mutex_leave(db->mutex); | 262 sqlite3_mutex_leave(db->mutex); |
| 226 return rc; | 263 return rc; |
| 227 } | 264 } |
| OLD | NEW |