Database engines
usually isolate parallel transactions for multiple clients.
Don't count on SQLite doing this. Any locks are on the entire database
file - only one transaction can be in progress.
I do have some data based on some tests I've run.
Having a cursor open does not lock the database,
Thanks for that report. Did your transaction test also have the
enable locking set? That may have had a worst case exclusive locking
effect (SQLite does not use exclusive write locks until commit time
normally).
FAQs 5 and 6 at this link provide more info -
http://www.sqlite.org/faq.html#q5
The preceding test was with SQLiteDatabase.setLockingEnabled(true),
the default.
With SQLiteDatabase.setLockingEnabled(false), the reading thread is
not starved. Behavior seemed similar to when a transaction was not
used. And my tests run successfully. I may be getting lucky and/or my
tests are
Interesting. Thanks for that link. It is a reasonable
speculation (guess) that the enable locking method has something
to do with the various threading options. In addition to thread safe
operation there is the question of how multiple processes (different
JVMs) inter-operate with the same
From the interface methods on SQLiteDatabase, it seems very much like
it is intended for one instance of SQLiteDatabase per open database,
and that you share it between threads.
You can apparently even set locking enabled.
=
public void setLockingEnabled (boolean lockingEnabled)
On Jan 21, 11:08 am, jotobjects jotobje...@gmail.com wrote:
You might want to look into the transaction paradigm/pattern:
http://developer.android.com/reference/android/database/sqlite/SQLite...
Transactions are the well understood way to get consistent results
with multiple readers and
On Jan 21, 12:09 pm, Nathan nathan.d.mel...@gmail.com wrote:
I put a transaction
around a long series of small updates and it was reduced to a few
seconds. This was a situation where you would think a transaction
would improve correctness, but degrade performance slightly.
That is not so
On Jan 21, 4:22 pm, jotobjects jotobje...@gmail.com wrote:
It doesn't make any sense to me that you have to turn locking on
(whatever that means) if you are using transactions.
You probably don't if you are using one thread.
I think the setLocking is about making the the SQLite *code*
8 matches
Mail list logo