1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add the OP_SetTabCol and OP_VerifyTabCol opcodes, only when compiling with

SQLITE_DEBUG, to do run-time verification of the column cache.

FossilOrigin-Name: b37614a3670770919a7c7f8157c5fd6578d736447998640b52e5cef8174cadc2
This commit is contained in:
drh
2018-06-11 17:35:02 +00:00
parent 8d7b212c4c
commit 299bf7c2f0
10 changed files with 123 additions and 18 deletions

View File

@@ -3200,6 +3200,13 @@ void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){
}
#endif
#ifdef SQLITE_DEBUG_COLUMNCACHE
/* Add a SetTabCol opcode for run-time verification that the column
** cache is working correctly.
*/
sqlite3VdbeAddOp3(pParse->pVdbe, OP_SetTabCol, iTab, iCol, iReg);
#endif
/* If the cache is already full, delete the least recently used entry */
if( pParse->nColCache>=SQLITE_N_COLCACHE ){
minLru = 0x7fffffff;
@@ -3373,6 +3380,9 @@ int sqlite3ExprCodeGetColumn(
if( p->iTable==iTable && p->iColumn==iColumn ){
p->lru = pParse->iCacheCnt++;
sqlite3ExprCachePinRegister(pParse, p->iReg);
#ifdef SQLITE_DEBUG_COLUMNCACHE
sqlite3VdbeAddOp3(v, OP_VerifyTabCol, iTable, iColumn, p->iReg);
#endif
return p->iReg;
}
}