1.Dd January 24, 2024 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.In sqlite3.h 9.Ft int 10.Fo sqlite3_finalize 11.Fa "sqlite3_stmt *pStmt" 12.Fc 13.Sh DESCRIPTION 14The sqlite3_finalize() function is called to delete a prepared statement. 15If the most recent evaluation of the statement encountered no errors 16or if the statement is never been evaluated, then sqlite3_finalize() 17returns SQLITE_OK. 18If the most recent evaluation of statement S failed, then sqlite3_finalize(S) 19returns the appropriate error code or extended error code. 20.Pp 21The sqlite3_finalize(S) routine can be called at any point during the 22life cycle of prepared statement S: before statement 23S is ever evaluated, after one or more calls to 24.Fn sqlite3_reset , 25or after any call to 26.Fn sqlite3_step 27regardless of whether or not the statement has completed execution. 28.Pp 29Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. 30.Pp 31The application must finalize every prepared statement 32in order to avoid resource leaks. 33It is a grievous error for the application to try to use a prepared 34statement after it has been finalized. 35Any use of a prepared statement after it has been finalized can result 36in undefined and undesirable behavior such as segfaults and heap corruption. 37.Sh IMPLEMENTATION NOTES 38These declarations were extracted from the 39interface documentation at line 5265. 40.Bd -literal 41SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); 42.Ed 43.Sh SEE ALSO 44.Xr sqlite3_reset 3 , 45.Xr sqlite3_step 3 , 46.Xr sqlite3_stmt 3 47