>> Some pragma are set be connection,
>> some by database (and all the connection to this database) and
>> some by the engine (all database and all connections)
> Could you give an example of this last category? I don't see by what possible 
> mechanism could a PRAGMA issued in one process connected to one database 
> file, affect a separate process connected to a different database file. 
> Einstein's spooky action at a distance?

for exemple page_size, encoding, auto_vaccum, legacy_file_format or also

 From the doc :
*PRAGMA secure_delete;
*When there are attached databases and no database is specified in the 
pragma, all databases have their secure-delete setting altered
The secure-delete setting for newly attached databases is the setting of 
the main database at the time the ATTACH command is evaluated

so doing this pragma will change the behavior of all the database and by 
the way all the connections ...


>> so how to distinguish the pragma that must be call on every connection
>> or just set one time after the DLL initialization ?
> I'm not aware of any pragmas that could be set once and somehow magically 
> take effect on all subsequent connections. How would you even set such a 
> pragma? You need a connection to run PRAGMA statements.

like page_size, encoding, auto_vaccum, legacy_file_format, secure_delete 
for exemple ? but i can say about this because the doc speak about it, 
but most of the time the doc say nothing :( for exemple what about 
cache_size when we use the Share_Cache mode ?

>> for exemple did i need to call the pragma read_uncommitted on every
>> connection
> Yes.

ok, that is clair :)

so can you confirm me that what i do is good :

at the initialization :
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
sqlite3_initialize;
sqlite3_enable_shared_cache(1);

after before creating any database i do :

PRAGMA page_size = 512
PRAGMA encoding = "UTF-8
PRAGMA legacy_file_format = 0
PRAGMA auto_vacuum = NONE

after for "EVERY" new connection on the database(s) i do :

PRAGMA cache_size = 2000
PRAGMA count_changes = 0
PRAGMA journal_mode = MEMORY
PRAGMA journal_size_limit = -1
PRAGMA locking_mode = NORMAL
PRAGMA read_uncommitted = 1
PRAGMA secure_delete = 0
PRAGMA synchronous = OFF
PRAGMA temp_store = MEMORY


is it an good way to do ?

thanks you by advance
stephane
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to