I was able to get the callback working. But I am curious as I am just seeing the same error details as the sqlite3 api itself returns. For e.g.
SQLITE_LOG: sqlite errcode=26, sqlite errmsg=file is encrypted or is not a database The same error code I get in the return value of sqlite3_step. Just wondering if there is a way I can get this error logging call back to print more details than this ? I have enabled extended error codes, is there a way I can get some more error details like :- -what part of the database is corrupted -what line number or when was this issue first detected -what is the extended error code in this scenarios ? -mayank -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Mayank Kumar (mayankum) Sent: Friday, July 18, 2014 12:26 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Sometimes when my process restarts, it returns error "database is locked" Thanks Simon. Now sqlite3_config is the first call we are making followed by sqlite3_open. I am checking the return code for all calls. In one of the sqlite3_step calls later, I am getting an error "file is encrypted or is not a database" but I don't see this callback getting called. Immediately after I get this error , the process kills itself purposely. I am only interested in knowing why my callback is not getting called in this scenario ? Is it not getting called because the process is not alive by that time or some other issue. The " file is encrypted or is not a database" error is being simulated by writing bad data at the header of the sqlite db while my application is running. Ret = Sqlite3_step() Ret = 26 Die()---kills itself Does the callback gets called before sqlite3_step returns with an error code or after ? Since if it gets called after, it may not happen. I want to enable this callback to get more fine grained information about whats going on with out system. Thanks for your help Mayank -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Tuesday, July 15, 2014 11:13 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Sometimes when my process restarts, it returns error "database is locked" On 15 Jul 2014, at 6:58pm, Mayank Kumar (mayankum) <mayan...@cisco.com> wrote: > I was calling it after sqlite3_open,I will try calling before sqlite3_open > and update the thread. When you call sqlite3_config() after sqlite3_open() it returns SQLITE_MISUSE to tell you you're doing it wrong. The fact that you didn't notice this error shows us you are not checking the result codes returned by (almost ?) all sqlite3 API calls. Checking these results codes for /every/ call helps programmers spot and correct almost all errors. It's important to check them all because often the error is returned by a different call to the one which, logically, should be generating the error. It's simple, you just replace <mysqlitecallhere> with something like if (<mysqlitecallhere> != SQLITE_OK) { <report error and quit> } When people report problems to this list, having them make this change to /every/ sqlite3 call makes a lot of them go away. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users