I think my sample code should have read as follows:

To activate the "defensive" flag for a database connection:
sqlite3_db_config(db, SQLITE_DBCONFIG_DEFENSIVE, 1, NULL);

(I got the wrong prefix before, and I discovered that it crashes if I
do not add the NULL argument.)

I hope I got this right, really wish it were better documented.


On Tue, Jan 29, 2019 at 10:17 AM Chris Brody <chris.br...@gmail.com> wrote:
>
> I am very sorry to say that I have found the usage of the
> SQLITE_DBCONFIG_DEFENSIVE option to be somewhat confusing.
>
> From my first reading of https://www.sqlite.org/releaselog/3_26_0.html
> I thought SQLITE_DBCONFIG_DEFENSIVE was a compile-time option. (I was
> proven wrong pretty quickly.)
>
> Then I found the following in
> https://www.sqlite.org/c3ref/c_dbconfig_defensive.html to be
> confusing:
>
> Looking at this entry:
>
> #define SQLITE_DBCONFIG_DEFENSIVE             1010 /* int int* */
>
> seems to indicate to me that I should pass 2 integer values after
> SQLITE_DBCONFIG_DEFENSIVE in the sqlite_db_config() call (which I
> think is wrong). I found it especially confusing since the example
> code for SQLITE_DBCONFIG_RESET_DATABASE shows 2 integers after
> SQLITE_DBCONFIG_RESET_DATABASE.
>
> I think there should be example code for SQLITE_DBCONFIG_DEFENSIVE
> that reads something like this:
>
> To activate the "defensive" flag for a database connection:
> sqlite_db_config(db, SQLITE_DBCONFIG_DEFENSIVE, 1);
>
> I think it would be ideal if there would be a compile-time flag that
> would tell SQLite to enable the "defensive" flag by default whenever
> the application opens a database.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to