jathpr
jathpr

Reputation: 33

When does SQLite save its cache to disk? (on Android)

I work with db (without content provider), and I'm interested to know when data will be written to the SD card. Does it happen immediately after method is call (Ex: insert, update) or is there a buffer in between the only writes occasionally, or when the buffer is full? (do I need have some method for saving the DB in onPause, or it's will be work correctly anywhere?)

P.S. the DB is closed when the application exits.

Upvotes: 3

Views: 1203

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006829

Does it happen immediately after method is call (Ex: insert, update)

Yes. More accurately, it happens immediately upon completion of the transaction. If you are not using your own transactions, each insert/update/delete/execSQL call is its own transaction.

or is there a buffer in between the only writes occasionally, or when the buffer is full?

No.

Upvotes: 3

Related Questions