1.Dd January 24, 2024 2.Dt SQLITE3_RESET 3 3.Os 4.Sh NAME 5.Nm sqlite3_reset 6.Nd reset a prepared statement object 7.Sh SYNOPSIS 8.In sqlite3.h 9.Ft int 10.Fo sqlite3_reset 11.Fa "sqlite3_stmt *pStmt" 12.Fc 13.Sh DESCRIPTION 14The sqlite3_reset() function is called to reset a prepared statement 15object back to its initial state, ready to be re-executed. 16Any SQL statement variables that had values bound to them using the 17sqlite3_bind_*() API retain their values. 18Use 19.Fn sqlite3_clear_bindings 20to reset the bindings. 21.Pp 22The sqlite3_reset(S) interface resets the prepared statement 23S back to the beginning of its program. 24.Pp 25The return code from sqlite3_reset(S) indicates whether 26or not the previous evaluation of prepared statement S completed successfully. 27If sqlite3_step(S) has never before been called on S 28or if sqlite3_step(S) has not been called since the 29previous call to sqlite3_reset(S), then sqlite3_reset(S) 30will return SQLITE_OK. 31.Pp 32If the most recent call to sqlite3_step(S) for the prepared statement 33S indicated an error, then sqlite3_reset(S) returns 34an appropriate error code. 35The sqlite3_reset(S) interface might also return an 36error code if there were no prior errors but the process 37of resetting the prepared statement caused a new error. 38For example, if an INSERT statement with a RETURNING 39clause is only stepped one time, that one call to sqlite3_step(S) 40might return SQLITE_ROW but the overall statement might still fail 41and the sqlite3_reset(S) call might return SQLITE_BUSY 42if locking constraints prevent the database change from committing. 43Therefore, it is important that applications check the return code 44from sqlite3_reset(S) even if no prior call to sqlite3_step(S) 45indicated a problem. 46.Pp 47The sqlite3_reset(S) interface does not change the 48values of any bindings on the prepared statement 49S. 50.Sh IMPLEMENTATION NOTES 51These declarations were extracted from the 52interface documentation at line 5293. 53.Bd -literal 54SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); 55.Ed 56.Sh SEE ALSO 57.Xr sqlite3_bind_blob 3 , 58.Xr sqlite3_clear_bindings 3 , 59.Xr sqlite3_stmt 3 , 60.Xr SQLITE_OK 3 61