Reset A Prepared Statement Object (original) (raw)
int sqlite3_reset(sqlite3_stmt *pStmt);
The sqlite3_reset() function is called to reset a prepared statementobject back to its initial state, ready to be re-executed. Any SQL statement variables that had values bound to them using the sqlite3_bind_*() API retain their values. Use sqlite3_clear_bindings() to reset the bindings.
If the most recent call to sqlite3_step(S) for theprepared statement S indicated an error, thensqlite3_reset(S) returns an appropriate error code. The sqlite3_reset(S) interface might also return an error codeif there were no prior errors but the process of resetting the prepared statement caused a new error. For example, if anINSERT statement with a RETURNING clause is only stepped one time, that one call to sqlite3_step(S) might return SQLITE_ROW but the overall statement might still fail and the sqlite3_reset(S) call might return SQLITE_BUSY if locking constraints prevent the database change from committing. Therefore, it is important that applications check the return code from sqlite3_reset(S) even if no prior call to sqlite3_step(S) indicated a problem.