[sqlite] serialized thread mode and transactions

2012-01-25 Thread Erik Fears
Hello, Right now I'm using WAL mode with a single writer, and many readers. At the moment, each reader is opening its own database connection. As you can imagine, this is quite expensive. Instead of maintaining a pool of sqlite connections, I'd like to move every thread to share the same

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Pavel Ivanov
For example, if the writer thread starts a transaction, and one of the reader threads does a SELECT, would the SELECT be part of the transaction? Or are transactions per-thread on a shared connection? All transactions are per-connection. So yes, SELECT will be a part of transaction and you

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Erik Fears
OK. So I'd probably give one connection to the writer, and then let the readers share a connection. So the next question is, if a reader is in the middle of an exec and has not finalized its statement yet, how would it affect another thread that attempts a statement? Thanks! --erik On Wed, Jan

Re: [sqlite] serialized thread mode and transactions

2012-01-25 Thread Pavel Ivanov
So the next question is, if a reader is in the middle of an exec and has not finalized its statement yet, how would it affect another thread that attempts a statement? Only one thread can enter sqlite3_* function on the same connection at the same time. So if you are using sqlite3_exec() then