Why finalize is very important in SQLite

Consider this, you have copied a sqlite db to a temporary file.
Lets name this temp.
sqlite3_stmt *queryStatement = NULL;
Now you do a sqlite open to this temp file.
prepare a sqlite statement using variable queryStatement.
you dont finalize this.
Again, you reuse this variable queryStatement for another prepare statement.
you only finalize this.
Now you try to delete the temp file. THIS WILL NOT GET DELETED, SINCE YOU HAVE NOT FINALIZED THE FIRST PREPARE STATEMENT. HENCE FINALIZING EACH AND EVERY PREPARE STATEMENT IS A MUST.
Destroy A Prepared Statement Object

Leave a Reply

Your email address will not be published. Required fields are marked *