5 ms·
Does this have hardcore locking in it? Last I knew sqlite doesn't support multi-users so this would just fall over with more than one client concurrently insert
by Quarrelsome 7y ago
Does this have hardcore locking in it? Last I knew sqlite doesn't support multi-users so this would just fall over with more than one client concurrently inserting data unless you throttle them into synchronous access.
- SQLite 7y agoSQLite supports multiple simultaneous connections to the database from separate processes. It just does not let more than one connection write at a time. SQLite takes care of serializing access for you - you don't have to put any synchronization code in your application. Your app just needs to be prepared to retry an insert if it gets back an SQLITE_BUSY result code.
- Quarrelsome 7y agoah, thanks for that. I appreciate knowing more.
- iakh 7y agoIsn't that worse though? Having to add retry logic seems to be more complex than a lock or singleton.
- icebraining 7y agoIt does have a lock, and you can set a busy timeout to wait instead of immediately getting an error from SQLite.
- umvi 7y agoIt seems like you can get SQLITE_BUSY even if you are a reader if someone else happens to be writing... I want to like SQLite but that just seems like a deal breaker
- SQLite 7y agoOnly in ROLLBACK journalling mode. Set "PRAGMA journal_mode=WAL" and this does not happen.