Recent

Author Topic: LAMW and sqlite with transactions  (Read 1785 times)

las

  • New Member
  • *
  • Posts: 26
LAMW and sqlite with transactions
« on: April 05, 2019, 11:27:34 am »
Hi!
Why sqliteDataAccess don't have procedures for using execSql with transactions? It's not possible?

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW and sqlite with transactions
« Reply #1 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"]
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

las

  • New Member
  • *
  • Posts: 26
Re: LAMW and sqlite with transactions
« Reply #2 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?

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW and sqlite with transactions
« Reply #3 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....
 
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

las

  • New Member
  • *
  • Posts: 26
Re: LAMW and sqlite with transactions
« Reply #4 on: April 08, 2019, 07:57:56 am »
How to execute two requests in one transaction?
« Last Edit: May 10, 2019, 03:02:39 pm by las »

las

  • New Member
  • *
  • Posts: 26
Re: LAMW and sqlite with transactions
« Reply #5 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?

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW and sqlite with transactions
« Reply #6 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!
« Last Edit: May 12, 2019, 05:10:19 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018