• Welcome, Guest. Please login.
 
November 17, 2019, 09:27:08 pm

News:

Welcome to the SQLitening support forums!


SQLiteningProcs and THREADED scope

Started by Bern Ertl, May 14, 2009, 01:39:37 pm

Previous topic - Next topic

Bern Ertl

If I develop a set of functions to implement a new data structure inside an SQLiteningProcs DLL, would setting the scope for the underlying base data as THREADED ensure that each connection to the database had it's own persistent copy of the data (persistent through numerous calls to various functions in the DLL), or is each function call to the SQLiteningProcs DLL being handled in a unique thread? Or are all function calls to the SQLiteningProcs DLL being handled in a single thread?


Fred Meier

Each connection at the server runs as a separate single thread.  This
means that all the commands as well as your SQLiteningProcs run in the
same unique thread for that connection.  So if two clients are connected
there are two threads running. 

Yes, using THREADED shared variables(globals) rather than GLOBAL ones
would seem to be the safe way to share date among several functions
within a SQLiteningProc running in a thread. 

I have not personally tested this concept so let us know how it works. 

Bern Ertl

Excellent.  I did a simple test and it appears to be working as described.  Each instance of the client calling the proc has it's own persistent copy of the data.