On 20 March 2018 at 22:33, Deon Brewis <d...@mylio.com> wrote:

> How do you actually get a SQLITE_CANTOPEN_ISDIR error?
>
> In order to get an extended result code, we need to pass a sqlite3*
> connection, but you don't have that if the file can't be opened in the
> first place.
>

I understand why you'd think that, but check the docs:

https://www.sqlite.org/capi3ref.html#sqlite3_open

> A database connection handle is usually returned in *ppDb, __even if an
error occurs__.
> The only exception is that if SQLite is unable to allocate memory to hold
the sqlite3 object,
> a NULL will be written into *ppDb instead of a pointer to the sqlite3
object.

So we're not looking at an "either an error or sqlite3* is returned" - you
can get both. The other thing to takeaway:

> Whether or not an error occurs when it is opened, resources associated
with the
> database connection handle should be released by passing it to
sqlite3_close()
> when it is no longer required.

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

Reply via email to