Hello,
I have a program using sqlite for document storage. Sqlite layer has
been quite stable until I replaced v3.10.2 with 3.11.
Relevant parts of the program are:
//at app startup
static void SqliteErrorLogCallback(void *pArg, int iErrCode, const char
*zMsg)
{
printf("Sqlite error (code: %d, txt: %s): %s\n", iErrCode,
sqlite3_errstr(iErrCode), zMsg);
}
..
sqlite3_config(SQLITE_CONFIG_LOG, SqliteErrorLogCallback, NULL);
sqlite3_initialize();
//main code
CppSQLite3Exception err;
m_db.open(szFile, &err);
m_db.setBusyTimeout(5000); // 5 seconds
m_db.execQuery("PRAGMA synchronous=FULL", &err);
When using 3.11 program gets error when executing pragma statement. When
I revert to 3.10.2 everything works OK.
Next I've tried to extract this code to sample project to show the
error, but the sample works without generating error :( I'm quite sure
that I don't have memory overruns or leaks.
Here is the error and the stack trace (I use Visual Studio 2013,
embedding sqlite as static library within my program):
Error:
Sqlite error (code: 1, txt: SQL logic error or missing database):
unrecognized token: "x"
Stack trace (relevant parts):
app.cpp (911): SqliteErrorLogCallback
sqlite\sqlite\sqlite3.c (23755): renderLogMsg
sqlite\sqlite\sqlite3.c (23765): sqlite3_log
sqlite\sqlite\sqlite3.c (132362): sqlite3RunParser
sqlite\sqlite\sqlite3.c (109989): sqlite3Prepare
sqlite\sqlite\sqlite3.c (110081): sqlite3LockAndPrepare
sqlite\sqlite\sqlite3.c (110145): sqlite3_prepare
sqlite\sqlite\sqlite3.c (109477): sqlite3InitCallback
sqlite\sqlite\sqlite3.c (109559): sqlite3InitOne
sqlite\sqlite\sqlite3.c (109759): sqlite3Init
sqlite\sqlite\sqlite3.c (109796): sqlite3ReadSchema
sqlite\sqlite\sqlite3.c (107813): sqlite3Pragma
sqlite\sqlite\sqlite3.c (130990): yy_reduce
sqlite\sqlite\sqlite3.c (131399): sqlite3Parser
sqlite\sqlite\sqlite3.c (132338): sqlite3RunParser
sqlite\sqlite\sqlite3.c (109989): sqlite3Prepare
sqlite\sqlite\sqlite3.c (110081): sqlite3LockAndPrepare
sqlite\sqlite\sqlite3.c (110157): sqlite3_prepare_v2
sqlite\cppsqlite3.cpp (1392): CppSQLite3DB::compile
sqlite\cppsqlite3.cpp (1276): CppSQLite3DB::execQuery
notecasecore\notecasecore\formats\formatiosqlite.cpp (312):
FormatIO_Sqlite::Load
notecasecore\notecasecore\notedocument.cpp (719): NoteDocument::Load
Breaking with debugger at the error inside sqlite3RunParser, it was
processing this query:
"CREATE TABLE x(type text,name text,tbl_name text,rootpage integer,sql
text)"
Why would the parser fail on its own internal SQL?
Any idea to point me to the possible source of error ?
File exists on disk and is readable.
Regards,
Miroslav