On Sun, 18 Nov 2012 13:46:21 +0400, Durga D <durga.d...@gmail.com>
wrote:

>Hi All,
>
>
>   What happens if sqlite3_close() called multiple times but
>sqlite3_open_v2() called only once.
>
>    Practically I dint see any malfunction/corruption here. I would like to
>know the behavior of sqlite in this scenario.

http://sqlite.org/c3ref/close.html says:

The C parameter to sqlite3_close(C) and sqlite3_close_v2(C) must be
either a NULL pointer or an sqlite3 object pointer obtained from
sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(), and not
previously closed. Calling sqlite3_close() or sqlite3_close_v2() with a
NULL pointer argument is a harmless no-op.

In other words, you should not close a database handle more than once.
If your program structure cannot guarantee that, the easiest way to
protect yourself against redundant closes is to set the handle to NULL
immediately after sqlite3_close*() returned SQLITE_OK everywhere in your
code.


-- 
Groet, Cordialement, Pozdrawiam, Regards,

Kees Nuyt

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

Reply via email to