Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Default Threading mode of SQLite in Android?

http://www.sqlite.org/threadsafe.html

From above link I came to know, SQLite support three different threading modes : Single-thread,Multi-thread and Serialized. I am just curious to know "What is the Default Threading mode of SQLite in Android"? is there any way to change Threading mode pragmatically? If so, how and what are the advantages I get? When to choose which one with some sample cases?

Thanks In Advance.

like image 951
Ganesh K Avatar asked Jun 23 '12 07:06

Ganesh K


1 Answers

Default Mode - Serialized

By default SqliteDatabase is Thread safe, you can check it on the Android Docs,

setLockingEnabled(boolean lockingEnabled)

From the Docs -

Control whether or not the SQLiteDatabase is made thread-safe by using locks around critical sections. This is pretty expensive, so if you know that your DB will only be used by a single thread then you should set this to false. The default is true.

like image 152
Lalit Poptani Avatar answered Oct 03 '22 23:10

Lalit Poptani