Lazarus

Programming => Operating Systems => Android => Topic started by: las on April 05, 2019, 11:27:34 am

Title: LAMW and sqlite with transactions
Post by: las on April 05, 2019, 11:27:34 am
Hi!
Why sqliteDataAccess don't have procedures for using execSql with transactions? It's not possible?
Title: Re: LAMW and sqlite with transactions
Post by: jmpessoa on April 08, 2019, 03:38:29 am

But it have [transparent to the LAMW users...]!

you can look for  "jSqliteDataAccess.java"  source code

[LAMW folder "......\android_wizard\smartdesigner\java"]
Title: Re: LAMW and sqlite with transactions
Post by: las on April 08, 2019, 07:19:23 am
Yes, I know that sqlite supports transactions. However, this is not possible when working with him in LAMW. I think it makes sense. It is also bad that block processing of requests goes in different transactions. It would be advisable to conduct them in a single transaction. It would be faster to maintain data integrity. Also, it would be good to update the database in one transaction. Otherwise, in the event of a failure in one request, the entire database will be in an incomprehensible state. And further. I have not found anywhere documenting the database updating tool. I only saw this in the source code on java. When does this update start?
Title: Re: LAMW and sqlite with transactions
Post by: jmpessoa on April 08, 2019, 07:54:37 am


Quote
Yes, I know that sqlite supports transactions. However, this is not possible when working with him in LAMW.

"under-the-hat"  LAMW call "jSqliteDataAccess.java" code that have "transactions" support....
 
Title: Re: LAMW and sqlite with transactions
Post by: las on April 08, 2019, 07:57:56 am
How to execute two requests in one transaction?
Title: Re: LAMW and sqlite with transactions
Post by: las on May 10, 2019, 03:03:13 pm


Quote
Yes, I know that sqlite supports transactions. However, this is not possible when working with him in LAMW.

"under-the-hat"  LAMW call "jSqliteDataAccess.java" code that have "transactions" support....

It would be very convenient if all UpdateTableBatch requests were executed in a single transaction. The integrity of the database would be respected (all requests were executed or all canceled) and would work much faster.

The implementation of sqlite in lazarus for Windows supports the ability to manage transactions in a user program. I open a transaction, execute several requests, and then either close or cancel. Why didn't they make the same implementation in LAMW?
Title: Re: LAMW and sqlite with transactions
Post by: jmpessoa on May 12, 2019, 05:00:01 am
Quote
It would be very convenient if all UpdateTableBatch requests were executed in a single transaction.....

Done!

Added build-in  transaction and boolean result to  "InsertIntoTableBatch"  method
Added build-in  transaction and boolean result to  "UpdateTableBatch"  method

and

Added "ExecSQLBatchAsync" [build-in  transaction] method   [can be used to "Insert" or "Update" ...  etc...]
Added  event "OnAsyncPostExecute" to notify Async task result....

Added SetBatchAsyncTaskType to remind  ExecSQLBatchAsync state....

Please, test it!
TinyPortal © 2005-2018