beginTransaction(), endTransaction(), and setTransactionSuccessful(). What exactly do they do?

前端 未结 2 581
陌清茗
陌清茗 2021-02-07 08:56

I have to provide synchronization when inserting, querying, updating and deleting items from a database. As far as I understand beginTransaction() and beginTr

相关标签:
2条回答
  • 2021-02-07 08:59

    Off course with Android! If you are working for reliable data manipulation then it is important to use following supported methods.

    BeginTransaction();
    SetTransactionSuccessful();
    EndTransaction(); 
    

    For further see this…In android it is highly important to use transactions when working with databases.

    0 讨论(0)
  • 2021-02-07 09:20

    Yes, it makes app smooth.Because SQLite consider one cursor as one transaction, so if we use begin transaction() before we insert big amount of data, then use setTransactionSuccessful() second, then endTransaction() in finally, SQLite will consider this insert event as one transaction, instead of hundreds of transactions.

    0 讨论(0)
提交回复
热议问题