1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Remove the sqlite3_reoptimize() API. The same functionality is now provided automatically to queries prepared using prepare_v2().

FossilOrigin-Name: 2c50b3d5aab7cd8cc841d61f8c3b2b34d2f0b54b
This commit is contained in:
dan
2009-10-19 18:11:09 +00:00
parent f7b0b0ad5f
commit 1d2ce4f804
11 changed files with 80 additions and 248 deletions

View File

@@ -915,17 +915,10 @@ static int vdbeUnbind(Vdbe *p, int i){
pVar->flags = MEM_Null;
sqlite3Error(p->db, SQLITE_OK, 0);
/* If the bit corresponding to this variable is set in Vdbe.opmask, set
** the optimizable flag before returning. This tells the sqlite3_reoptimize()
** function that the VM program may benefit from recompilation.
**
** If the bit in Vdbe.expmask is set, then binding a new value to this
** variable invalidates the current query plan. This comes about when the
** variable is the RHS of a LIKE or GLOB operator and the LIKE/GLOB is
** able to use an index. */
if( (i<32 && p->optmask & ((u32)1 << i)) || p->optmask==0xffffffff ){
p->optimizable = 1;
}
/* If the bit corresponding to this variable in Vdbe.expmask is set, then
** binding a new value to this variable invalidates the current query plan.
*/
assert( p->isPrepareV2 || p->expmask==0 );
if( (i<32 && p->expmask & ((u32)1 << i)) || p->expmask==0xffffffff ){
p->expired = 1;
}
@@ -1221,24 +1214,3 @@ int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
return v;
}
/*
** If possible, optimize the statement for the current bindings.
*/
int sqlite3_reoptimize(sqlite3_stmt *pStmt){
int rc = SQLITE_OK;
Vdbe *v = (Vdbe *)pStmt;
sqlite3 *db = v->db;
sqlite3_mutex_enter(db->mutex);
if( v->isPrepareV2==0 || v->pc>0 ){
rc = SQLITE_MISUSE;
}else if( v->optimizable ){
rc = sqlite3Reprepare(v);
rc = sqlite3ApiExit(db, rc);
}
assert( rc!=SQLITE_OK || v->optimizable==0 );
sqlite3_mutex_leave(db->mutex);
return rc;
}