Hi,
Can I use one TLiteConnection from multiple threads in same time without any synchronization in my code (TCriticalSection, Synchronize, etc) ? Or I must create separate TLiteConnection in each thread ? Can't find anything about it in Help file.
And second question: should I use TLiteConnection.Options.EnableSharedCache for best perfromance if I read/write to database from threads ?
Thanks for help !
Using TLiteConnection from threads
Re: Using TLiteConnection from threads
Hello,
Yes, LiteDAC allows working with SQLite in threads: for parallel access to a DB from different threads, extended options were added to delimit simultaneous access to a DB: BusyTimeout, EnableSharedCache, ReadUncommitted. You can find more detailed information on these options in the LiteDAC help.
P.S. Moreover, SQLite thread-safety depends on the value of the SQLITE_THREADSAFE option, that was set when building the SQLite library. In the Direct mode, we use the value "1" supposing full thread-safety.You can refer to the SQLite developers site for more detailed information: http://www.sqlite.org/compile.html#threadsafe ,
http://www.sqlite.org/threadsafe.html .
Yes, LiteDAC allows working with SQLite in threads: for parallel access to a DB from different threads, extended options were added to delimit simultaneous access to a DB: BusyTimeout, EnableSharedCache, ReadUncommitted. You can find more detailed information on these options in the LiteDAC help.
P.S. Moreover, SQLite thread-safety depends on the value of the SQLITE_THREADSAFE option, that was set when building the SQLite library. In the Direct mode, we use the value "1" supposing full thread-safety.You can refer to the SQLite developers site for more detailed information: http://www.sqlite.org/compile.html#threadsafe ,
http://www.sqlite.org/threadsafe.html .