Recent

Author Topic: LAMW jsqlitedataaccess  (Read 4136 times)

Diapason

  • Newbie
  • Posts: 2
LAMW jsqlitedataaccess
« on: November 25, 2017, 12:49:36 am »
I am a newbie to LAMW and need help in using jsqlitedataaccess component to update a pre-existing sqlite database.  I know that the sqlite demos that do a table update immediately after an insert work OK, but I cannot get my changes committed when running a separate update statement like this...

  jSqliteDataAccess1.Close;
  jSqliteDataAccess1.OpenOrCreate(jSqliteDataAccess1.DatabaseName);
  jSqliteDataAccess1.UpdateTable('UPDATE INVENTORY SET QTYOH=107 WHERE ID=8');

The jSqliteDataAccess1 component does not currently have methods for 'begin transaction, 'end transaction', or 'commit', nor any obvious way of confirming that the database is actually in a writable state.  I have tried running 'BEGIN TRANSACTION' etc under ExecSQL - but that just triggers a crash.  Any help greatly appreciated.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: LAMW jsqlitedataaccess
« Reply #1 on: November 25, 2017, 02:10:13 am »
Hello Diapason!

Indeed,  "UpdateTable"  dont have "transaction"  support   [I will try improve it!]

but, yes, ExecSQL, have ["under the hat"]  "transaction"  support !!!!

[Ok. We can improve here, too, returning true or false ....  I will try improve it!]

The java [called ] code is "jSqliteDataAccess.java" [ LAMW folder " .....\java\lamwdesigner"]
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Diapason

  • Newbie
  • Posts: 2
Re: LAMW jsqlitedataaccess
« Reply #2 on: November 25, 2017, 02:40:29 am »
Many thanks jmpessoa,  LAMW is a great project by the way :)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: LAMW jsqlitedataaccess
« Reply #3 on: November 25, 2017, 07:56:29 am »
You could also try the LAMW+mORMot combo.
mORMot runs great on Android and has all the features you want ... and MANY more.

If you use the mORMot, you can have transactions, batches.
And switch from a local database towards a remote (https/websockets) one in a single line of code.

For me personally, the greatest benefit of using the mORMot is this:
a: writing and testing and debugging the database logic on Windows or Linux.
b: direct use of this logic on any other system without a single code change.
« Last Edit: November 25, 2017, 08:01:49 am by DonAlfredo »

 

TinyPortal © 2005-2018