On Fri, 2009-11-20 at 13:45 -0800, Albert Santoni wrote: > Apparently I didn't read the fine print that says SQLite doesn't > support concurrent multiple writer connections, and so the new library > code is semi-broken at the moment. To the best of my understanding, we > have two options for solving this: > > 1) Try to write some sort of wrapper around part of QtSql that queues > all SQL interactions into a single thread.
> > 2) Reorganize the code that uses the database so that the queries all > get executed in the GUI thread. > > So the question is, can we refactor the DB access in the above code to > emit a signal that runs these queries in the GUI thread? Having written a large sqlite-based program (in python), I'm a little confused by the problem. Sqlite does allow multiple connections via threads, as long as all calls to sqlite are made from the same thread that created the sqlite connection. You do mention at the top that sqlite doesn't support concurrent *writer* connections, but then your solutions involve moving *all* sqlite interaction to one thread. So, firstly, if some threads only need to read from the DB, then multiple connections are ok. But secondly, I don't accept the statement that sqlite doesn't support multiple writer connections. As of sqlite3, although it technically still doesn't support concurrent writes, the locking is all taken care of by sqlite itself (http://www.sqlite.org/lockingv3.html). My software has multiple writing db connections, all in different threads, and I've never had a race condition along these lines in 3 or 4 years of using this software every day (it's an RSS reader). I've had to debug a lot of race conditions in the past for other reasons, and I've already run into my share of SQLite issues, and this has never been one of them. So, is the issue the problem of sqlite calls blocking some important thread? Or is there something else I'm missing? Based on my own experience, I don't understand what the major problem is. owen ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Mixxx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mixxx-devel
