mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
The callback on sqlite3_trace() is invoked the first time sqlite3_step()
is called after sqlite3_prepare() or sqlite3_reset(). Ticket #900. (CVS 1960) FossilOrigin-Name: 0cc2f40e6afa157ead45140c4e28a9a33c469b73
This commit is contained in:
@@ -150,6 +150,30 @@ int sqlite3_step(sqlite3_stmt *pStmt){
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
if( p->pc<0 ){
|
||||
/* Invoke the trace callback if there is one
|
||||
*/
|
||||
if( (db = p->db)->xTrace && !db->init.busy ){
|
||||
assert( p->nOp>0 );
|
||||
assert( p->aOp[p->nOp-1].opcode==OP_Noop );
|
||||
assert( p->aOp[p->nOp-1].p3!=0 );
|
||||
assert( p->aOp[p->nOp-1].p3type==P3_DYNAMIC );
|
||||
sqlite3SafetyOff(db);
|
||||
db->xTrace(db->pTraceArg, p->aOp[p->nOp-1].p3);
|
||||
if( sqlite3SafetyOn(db) ){
|
||||
p->rc = SQLITE_MISUSE;
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Print a copy of SQL as it is executed if the SQL_TRACE pragma is turned
|
||||
** on in debugging mode.
|
||||
*/
|
||||
#ifdef SQLITE_DEBUG
|
||||
if( (db->flags & SQLITE_SqlTrace)!=0 ){
|
||||
sqlite3DebugPrintf("SQL-trace: %s\n", p->aOp[p->nOp-1].p3);
|
||||
}
|
||||
#endif /* SQLITE_DEBUG */
|
||||
|
||||
db->activeVdbeCnt++;
|
||||
p->pc = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user