On 5 Jun 2015, at 9:19pm, George <g.lister at nodeunit.com> wrote:

> 1) I open a database via:
>       sqlite3_initialize()
>       sqlite3_open_v2
> 2) I do some work on getting metadata from the database like table
> names and their fields and then
> 3) I close the connection via:
>       sqlite3_close_v2
>       sqlite3_shutdown

There's no need to call _initialize().  It won't do any harm, but there's no 
need for it.  The code in _open_v2() checks for it and calls it if you haven't 
already.

If your application is going to do more SQLite, don't call _shutdown().  If you 
have already closed your database connections the amount of resources released 
is negligible and the _shutdown() and _reinitialize() pair can take quite a 
long time to execute.  You can actually forget to call _shutdown() alltogether. 
 All it does is release resources which will be released automatically when 
your program quits.

With all the calls you listed above, are you checking the results returned to 
make sure they're equal to SQLITE_OK ?

If the code in your step (2) includes any statements (e.g. if you use 
_prepare/_step) then are you finalizing each statement before you use _close() 
?  Are you checking the values returned by _finalize() to make sure they're 
SQLITE_OK ?

Simon.

Reply via email to