1.Dd December 19, 2018 2.Dt SQLITE3_FINALIZE 3 3.Os 4.Sh NAME 5.Nm sqlite3_finalize 6.Nd Destroy A Prepared Statement Object 7.Sh SYNOPSIS 8.Ft int 9.Fo sqlite3_finalize 10.Fa "sqlite3_stmt *pStmt" 11.Fc 12.Sh DESCRIPTION 13The sqlite3_finalize() function is called to delete a prepared statement. 14If the most recent evaluation of the statement encountered no errors 15or if the statement is never been evaluated, then sqlite3_finalize() 16returns SQLITE_OK. 17If the most recent evaluation of statement S failed, then sqlite3_finalize(S) 18returns the appropriate error code or extended error code. 19.Pp 20The sqlite3_finalize(S) routine can be called at any point during the 21life cycle of prepared statement S: before statement 22S is ever evaluated, after one or more calls to sqlite3_reset(), 23or after any call to sqlite3_step() regardless of whether 24or not the statement has completed execution. 25.Pp 26Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. 27.Pp 28The application must finalize every prepared statement 29in order to avoid resource leaks. 30It is a grievous error for the application to try to use a prepared 31statement after it has been finalized. 32Any use of a prepared statement after it has been finalized can result 33in undefined and undesirable behavior such as segfaults and heap corruption. 34.Sh SEE ALSO 35.Xr sqlite3_stmt 3 , 36.Xr sqlite3_reset 3 , 37.Xr sqlite3_step 3 38