1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Add the experimental sqlite3_stmt_explain(S,E) interface.

FossilOrigin-Name: 5683743ddf0bb051f2fe5d137cc18407e000e77e9faa9010a22e3134b575638b
This commit is contained in:
drh
2023-07-15 16:48:14 +00:00
parent a02d6d8237
commit e393f6eff0
8 changed files with 108 additions and 37 deletions

View File

@@ -1814,6 +1814,22 @@ int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt){
return pStmt ? ((Vdbe*)pStmt)->explain : 0;
}
/*
** Set the explain mode for a statement.
*/
int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode){
Vdbe *v = (Vdbe*)pStmt;
int rc;
if( v->eVdbeState!=VDBE_READY_STATE ) return SQLITE_BUSY;
if( v->explain==eMode ) return SQLITE_OK;
if( v->zSql==0 || eMode<0 || eMode>2 ) return SQLITE_ERROR;
sqlite3_mutex_enter(v->db->mutex);
v->explain = eMode;
rc = sqlite3Reprepare(v);
sqlite3_mutex_leave(v->db->mutex);
return rc;
}
/*
** Return true if the prepared statement is in need of being reset.
*/