Shouldn't temp_store_directory be private to a sqlite3 structure?
Currently it is global (in os_*.c), so setting a value through the pragma
affects to all currently opened sqlite connections within the process which
may be undesirable.
I guess the basic idea is to keep as minimum global variables as posible.
Also, in case the library is loaded, unloaded and reloaded, the known "not
memory leak" (sqlite3 global data only released at app exit) will be a true
memory leak since that memory segment belong to the process. I see this in
case one would like to dinamically load/unload the library to update de
sqlite library without stopping the app.
To achieve this the only needed functions would be some of Sqlite3InitLib
and Sqlite3DeInitLib.
I can imagine (actually ofuscated) apps like a sqlite library distribution
server, if a new version is out, then the app could retrieve, unload and
load it again safely without leaks.