On Tue, Sep 6, 2011 at 2:28 PM, Grice, Lynton (L) <lynton.gr...@sasol.com>wrote:
> May I ask what you suggest with the way I am using the > sqlite3_busy_handler? What is the "normal approach"? I have tried to look at > examples etc > Hi! i don't use the busy handler, so i can't say, but i do know that it is NEVER valid to use a free()d pointer, and that's essentially what you've done here. If you don't want to pass any data to the busy handler then pass NULL as the final argument instead of a value which will be free()d immediately afterward sqlite3_busy_handler(). > p = sqlite3_malloc(256); > sqlite3_busy_handler(handle, &eventLoggerBusyHandler, p); > sqlite3_free(p); > > Also, you mentioned the following "should fail" > sqlite3_exec(handle,"PRAGMA default_cache_size = 50;",0,0,0); > i didn't say it should/would, i implied that it _could_ by asking if you are _sure_ that it won't fail. If that fails, it might be useless to continue with the other queries, but the return code is not checked here. Even "cannot fail" commands with perfect SQL syntax and well-defined semantics can fail because of external problems. e.g. out-of-memory or i/o error. Once you get one of these errors, it's generally not a good idea to continue using the db handle (i would argue, though there are those who could rightly argue otherwise). -- ----- stephan beal http://wanderinghorse.net/home/stephan/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users