android - sqlite transaction during lengthy operation -


i'm building app make orders. when add item in order, remove item quantity stock. if goes wrong or user cancel order, need revert stock operations. so, when start new order, call begintransaction(). keep adding items. , when i'm done, commit transaction settransactionsuccessful() , endtransaction().

when inside thread started transaction, can 'see' data changed. in other hand, data not commited, so, not present if run query thread.

how can these changed data thread without commit transaction?

i have thinking in make kind of query serialization pool of queries inside thread.

i'm in right way?

the context of transaction database connection (sqlitedatabase in android).

to allow other threads access data changed in transaction, have share sqlitedatabase object. (use normal synchronized mechanism manage concurrent accesses object.)


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -