On 9 Aug 2017, at 3:31am, Jacky Lam <jacky...@gmail.com> wrote:
> 1. Can I call sqlite3_open more than one times before calling sqlite3_close > and sqlite3_free? Call sqlite3_open() for each database you want to open. You can have any number of databases open at the same time. Call sqlite3_close() for each database you have open when you no longer need it. After closing the last connection call sqlite3_shutdown() as described in <https://sqlite.org/c3ref/initialize.html> (The above ignores use of SQL's ATTACH command.) You are not expected to ever call sqlite3_free() unless you are using SQLite to do other memory-handing tasks for you. Most people who use SQLite never call sqlite3_free(). > 2. If the above mentioned devices change to mutli-thread setting but no > thread safe functions such as mutex, is this setting still fine? You have explicitly declared SQLITE_THREADSAFE=0 . That means you will arrange that only one thread will be doing SQLite calls at once. As long as you can ensure this, SQLite will function correctly. > If not, how can I make it thread safe with lack of mutex support in > the system? Do any of the following: A) Implement your own mutex system. B) Use SQLite’s mutex system ( <https://sqlite.org/c3ref/mutex_alloc.html> ) C) Supply the value SQLITE_OPEN_FULLMUTEX when you open connections using sqlite3_open_v2(), as described in <https://sqlite.org/c3ref/open.html> . Please note that the above is a top-of-the-head answer and I have not personally tries each of the options to make sure it works. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users