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

Save a few bytes and a few cycles by setting Vdbe.expmask to zero for

statements prepared using legacy interface sqlite3_prepare().

FossilOrigin-Name: a8fd705258643863493476f8b42ee981608a339f
This commit is contained in:
dan
2017-02-23 16:30:16 +00:00
parent 24d772cc27
commit bda4cb876c
4 changed files with 17 additions and 14 deletions

View File

@@ -154,7 +154,8 @@ int sqlite3_clear_bindings(sqlite3_stmt *pStmt){
sqlite3VdbeMemRelease(&p->aVar[i]);
p->aVar[i].flags = MEM_Null;
}
if( p->isPrepareV2 && p->expmask ){
assert( p->isPrepareV2 || p->expmask==0 );
if( p->expmask ){
p->expired = 1;
}
sqlite3_mutex_leave(mutex);
@@ -1258,9 +1259,8 @@ static int vdbeUnbind(Vdbe *p, int i){
** as if there had been a schema change, on the first sqlite3_step() call
** following any change to the bindings of that parameter.
*/
if( p->isPrepareV2 &&
((i<32 && p->expmask & ((u32)1 << i)) || p->expmask==0xffffffff)
){
assert( p->isPrepareV2 || p->expmask==0 );
if( p->expmask & ((u32)1 << (i&0x001F)) && (i<32 || p->expmask==0xffffffff) ){
p->expired = 1;
}
return SQLITE_OK;
@@ -1523,10 +1523,12 @@ int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
if( pFrom->nVar!=pTo->nVar ){
return SQLITE_ERROR;
}
if( pTo->isPrepareV2 && pTo->expmask ){
assert( pTo->isPrepareV2 || pTo->expmask==0 );
if( pTo->expmask ){
pTo->expired = 1;
}
if( pFrom->isPrepareV2 && pFrom->expmask ){
assert( pFrom->isPrepareV2 || pFrom->expmask==0 );
if( pFrom->expmask ){
pFrom->expired = 1;
}
return sqlite3TransferBindings(pFromStmt, pToStmt);