Android Question How do I commit changes to sqlite?

Wien.Mart

Member
Licensed User
Longtime User
Dear All,

I have a sqlite database being updated by my app. When I update a record set, I do not get the updated values in the table. When I select the specific record set from the table into a form, the updated record is correct. Is there a way to call a specific command to commit the changes to the sqlite so when I load the table again, I get the updated record?

Thanks,

Martin
 

eps

Expert
Licensed User
Longtime User
Martin,

Are you able to show us some of the code? Are you sure you're attempting to retrieve the data you think has changed?

As Erel mentioned, something like :

B4X:
    SQL1.BeginTransaction

some SQL, update

    SQL1.EndTransaction

some more SQL, read

Should see changes here, but you might want to put a try and catch in, to see if any errors occurred - maybe the SQL update isn't working as expected, so values aren't being updated or the SQL retrieve failed for some reason.


Phil
 
Last edited:
Upvote 0

Claudio Oliveira

Active Member
Licensed User
Longtime User
SQLite also implements the SQL commands "BEGIN TRANSACTION", "COMMIT TRANSACTION", "ROLLBACK TRANSACTION", "END TRANSACTION", "SAVEPOINT", etc...
Are there any recommendations on wich is the best way to manage database transacions?
I mean, which is better: using B4A SQL object, or native SQL commands implemented by SQLite itself?

Regards,
Claudio
 
Upvote 0
Top