> I am now using SQLite version 3.3.5, and i cannot find flag > SQLITE3_THREADSAFE in source code, so my question is how can i ensure i > compile with this option?
Probably there was no such flag in that version yet (I don't know enough about it). Why don't you use the latest version? > The second question is when i met SQLITE_MISUSE error, can i reset or reopen > the database to avoid this error? You cannot reset database connection, but you can close it (probably finalizing all statements before that using http://www.sqlite.org/c3ref/next_stmt.html if it exist in 3.3.5) and open it again. Pavel On Sun, Jan 10, 2010 at 12:27 AM, tim shen <bh_s...@hotmail.com> wrote: > > hi Pavel, > Thanks for your reply and reminder. > I am now using SQLite version 3.3.5, and i cannot find flag > SQLITE3_THREADSAFE in source code, so my question is how can i ensure i > compile with this option? > > The second question is when i met SQLITE_MISUSE error, can i reset or reopen > the database to avoid this error? > > Regards, > Tim > > > Pavel Ivanov-2 wrote: >> >> Oh, and one more thing: sqlite-dev list is for questions related to >> developing SQLite itself. For problems with using SQLite you should >> write to sqlite-users list (put in CC). >> >> Pavel >> >> On Fri, Jan 8, 2010 at 7:50 AM, Pavel Ivanov <paiva...@gmail.com> wrote: >>> As you're new to SQLite you could easily make some incorrect usages of >>> SQLite's API. But we won't be able to say to you exactly what is >>> incorrect until we don't see the actual code. So please show it to us. >>> Incidentally exact value of SQLITE3_THREADSAFE (0, 1 or 2) during >>> compilation is also important as well as any other flags you use. >>> >>> And just out of curiosity: how did you check that the reason "using >>> sqlite_close or calling sqlite_exec with the same database pointer >>> simultaneously from two separate threads" is not applied to you if as >>> you said in the application "you saved this handle as global variable, >>> then in other threads you use it"? >>> >>> >>> Pavel >>> >>> On Fri, Jan 8, 2010 at 3:42 AM, Tim Shen <bh_s...@hotmail.com> wrote: >>>> Hi All, >>>> >>>> I am new to SQLite and recently I took over a new project which using >>>> SQLite DB under WinCE. We build the SQlite.dll using flag >>>> SQLITE3_THREADSAFE, and used Multi-Thread programming in the >>>> application. >>>> The problem is that in some operations, function call sqlite3_exec() >>>> will >>>> throw out error SQLITE_MISUSE. >>>> I call the sqlite3_open16() and sqlite3_close() in main thread and >>>> saved >>>> this handle as global variable. Then in other threads, I will use this >>>> global variable to call other sqlite3 function such as >>>> sqlite3_exec(),sqlite3_get_table(),sqlite3_free_table(). >>>> I searched on the sqlite3 site, and got the following information >>>> >>>> SQLITE_MISUSE >>>> This error might occur if one or more of the SQLite API routines is used >>>> incorrectly. Examples of incorrect usage include calling sqlite_exec >>>> after >>>> the database has been closed using sqlite_close or calling sqlite_exec >>>> with >>>> the same database pointer simultaneously from two separate threads. >>>> >>>> I checked above 2 possible reason may caused this error and make sure it >>>> is >>>> not caused by them. Any other advise you guys can give it to me? Thanks >>>> in >>>> advance. >>>> >>>> Regards, >>>> Tim >>>> >>>> _______________________________________________ >>>> sqlite-dev mailing list >>>> sqlite-...@sqlite.org >>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-dev >>>> >>> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> >> > > -- > View this message in context: > http://old.nabble.com/Re%3A--sqlite-dev--Why-I-always-got-error-SQLITE_MISUSE-21--*-Library-used-incorrectly-*--tp27075467p27095772.html > Sent from the SQLite mailing list archive at Nabble.com. > > _______________________________________________ > 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