Android Question SQLITE/SQLCipher

Guenter Becker

Active Member
Licensed User
Good Morning to you,
as I understood the database itself and the Resultset are two independent Objects. INSERT/UPDATE DELETE will change the Database Data but the Resultset Data is not synchronized and is not effected by those actions.

To solve this I save the SELECT statement and after doing one of this operation I reloaded the Resultset to make shure that it contains the newly Database changes. In my opinion this is not the best solution.

My question:
Is it possible and if yes how to insert, update or delete a row of the Resultset by code? B4A codesnipped would be fine. Thankyou.
 

DonManfred

Expert
Licensed User
Longtime User
You can update any Data in your Database.
Use Update to update a dataset.

You can not change a Resultset though.
Change the data and run the query again to get updated results in Resultset.
 
Upvote 0

Guenter Becker

Active Member
Licensed User
You can update any Data in your Database.
Use Update to update a dataset.

You can not change a Resultset though.
Change the data and run the query again to get updated results in Resultset.
Thank you for quick response. As I wrote that is exactly what I do. What I do not know if the Resultset is working simmilar to a B4XTable with loading Data by Paging. I did not try it yet but it seems to that loading big Data from the Database (let's say 1000 Records) will use some waiting time. Do you have any experiance?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Good Morning to you,
as I understood the database itself and the Resultset are two independent Objects. INSERT/UPDATE DELETE will change the Database Data but the Resultset Data is not synchronized and is not effected by those actions.

To solve this I save the SELECT statement and after doing one of this operation I reloaded the Resultset to make shure that it contains the newly Database changes. In my opinion this is not the best solution.

My question:
Is it possible and if yes how to insert, update or delete a row of the Resultset by code? B4A codesnipped would be fine. Thankyou.
You will necessarily have to execute the SELECT query again and first close the ResultSet.
 
Upvote 0

Guenter Becker

Active Member
Licensed User
Ok, thank you
maybe it will be a good whish to have a sync option in the Resultset but that should be something todo by Erel.

Nearby the requested help/information are good as well for SQLCipher because the Base of SQLCipher is SQLite.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
The resultset is synchronized if it's set to CONCUR_UPDATABLE and TYPE_FORWARD_ONLY

You can then do a SELECT, change the data in the resultset (rs.updateString(xxx,yyy) ), then update the db with rs.updateRow()

Not sure any current libraries support this though, you may need to revert to pure java to implement.
 
Upvote 0
Top