Hopefully it is mode 3?1. Single-thread. In this mode, all mutexes are disabled and SQLite is unsafe to use in more than a single thread at once.
2. Multi-thread. In this mode, SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads.
3. Serialized. In serialized mode, SQLite can be safely used by multiple threads with no restriction.
SQLite threadmode...
- DoubleDutch
- Addict

- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
SQLite threadmode...
Does anyone know what mode SQLite is supplied in with PB?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
-
Num3
- PureBasic Expert

- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Re: SQLite threadmode...
Good question!!
Even though it is stated in the Sqlite doc's that:

Even though it is stated in the Sqlite doc's that:
Threads are EVIL
- netmaestro
- PureBasic Bullfrog

- Posts: 8453
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: SQLite threadmode...
SQLite's doc does say that the default mode is serialized, so that seems promising.
BERESHEIT
Re: SQLite threadmode...
Currently the mode is 'serialized'.
I think this may be a bit overkill though, because the PB database library (and object system in general) are not prepared for multi-threaded access to the same object, so by pure PB means you cannot make use of the 'serialized' mode anyway. So we might change this to 'multi-thread' in the future. Might be interesting to see if this makes a significant speed difference.
Anyway, you can switch between 'multi-thread' and 'serialized' at runtime, so if you really need the 'serialized' mode, i suggest you call the appropriate function to explicitly set the 'serialized' mode and you should be safe for the future should we decide to change it (we won't change it to 'single-thread' as that won't work with the PB threadsafe mode).
I think this may be a bit overkill though, because the PB database library (and object system in general) are not prepared for multi-threaded access to the same object, so by pure PB means you cannot make use of the 'serialized' mode anyway. So we might change this to 'multi-thread' in the future. Might be interesting to see if this makes a significant speed difference.
Anyway, you can switch between 'multi-thread' and 'serialized' at runtime, so if you really need the 'serialized' mode, i suggest you call the appropriate function to explicitly set the 'serialized' mode and you should be safe for the future should we decide to change it (we won't change it to 'single-thread' as that won't work with the PB threadsafe mode).
quidquid Latine dictum sit altum videtur
- DoubleDutch
- Addict

- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: SQLite threadmode...
Thanks for the info. Maybe some docs on how to set the mode would be helpful in the help file for people who don't read this post... 
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system