Thanks everyone for your help.  I was getting the error in some cases 
SQLITE_MISUSE .  That's error code 21.


Throughout my functions I may have called sqlite_close too much and this has 
caused some issues when going to delete the file.  At this point removing all 
the excess sqlite_close(handle) calls it seems to have ended the issue.


If I try to close a database using the  sqlite_close(handle) function and I get 
a return code of SQLITE_MISUSE, will this prevent me from deleting the database 
file that 'handle' connects to?


Thanks


________________________________
From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> on behalf of 
Richard Hipp <d...@sqlite.org>
Sent: Wednesday, 28 June 2017 7:55 PM
To: SQLite mailing list
Subject: Re: [sqlite] Cannot delete a Database file?

On 6/28/17, Domonic Tom <abdom...@hotmail.com> wrote:
>
> Would anyone know how to go about making sure that the database file is not
> busy and can be deleted.  Is there a specific function for this.
>

Call sqlite3_finalize() on all prepared statements before calling
sqlite3_close().  Probably you are leaking prepare statements - in
other words there are one or more prepared statements that you have
failed to call sqlite3_finalize() for.

Consider adding the "stmts" virtual table to your project
(https://www.sqlite.org/src/file/ext/misc/stmts.c) and then run the
query "SELECT sql FROM stmts" and print out the results just prior to
calling sqlite3_close().  That will clearly show you which prepared
statements you have forgotten to finalize.
--
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
sqlite-users Info 
Page<http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
mailinglists.sqlite.org
To see the collection of prior postings to the list, visit the sqlite-users 
Archives. (The current archive is only available to the list ...



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to