On Mon, Mar 3, 2008 at 10:47 AM, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> Scott Hess <[EMAIL PROTECTED]> wrote:
>  > On Mon, Mar 3, 2008 at 10:16 AM, Igor Tandetnik
>  > <[EMAIL PROTECTED]> wrote:
>  >> Jerry Krinock <[EMAIL PROTECTED]> wrote:
>  >>  > The Blob Example [1] contains code [2] in which, if
>  >>  sqlite3_prepare() > fails, the subsequent call to
>  >>  sqlite3_finalize() is skipped.  Is this > OK?
>  >>
>  >>  If sqlite3_prepare fails, you don't get a valid sqlite3_stmt
>  >>  handle, so there's nothing to call sqlite3_finalize on.
>  >
>  > sqlite3_finalize() returns SQLITE_OK when you pass NULL.
>
>  Perhaps, but does it actually do anything useful when passed NULL? I
>  don't quite see how it can.

True, but my code snippet didn't check for NULL.  If, for some reason,
SQLite returned a partial statement handle with an error code, then
I'd expect you would want to pass it back to sqlite3_finalize().
Since sqlite3_finalize() explicitly handles NULL, I think you can
safely just pump the statement handle from sqlite3_prepare() back to
sqlite3_finalize(), regardless of what it is.

This is how sqlite3_open()/sqlite3_close() work.

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

Reply via email to