Servoy supports 2 types of transactions. Database (DB) transactions and in-memory (IM) transactions.
When using DB transactions everything everything is handled by the back end database and it all works as expected. You can rollback any changes, deletes, etc you made or commit it so that other users see your changes. There is however one downside to this. Locking.
Not every SQL vendor handles DB transactions the same way, some allow all reads even when a record is changed (UDB,Oracle,PostgreSQL) but others don't even allow reads on these records (Sybase, MySQL, MSSQL with default settings) because they lock the record, page or even the whole table (!). And there are use-cases where every vendor will have a lock. So you want to keep these DB transactions as short as possible when you use them.
So what about IM transactions? They keep all the changes in memory of the Servoy client instance when you disable autosave (databaseManager.setAutoSave(false) ) and will only send it to the backend database when you call databaseManager.saveData() or fetch the current data from the database when you call databaseManager.rollbackEditedRecords(). Sounds like the perfect alternative to DB transactions!
Yes, but this approach also has a downside. When you delete a record this is send directly to the backend database so you can't rollback this record.
Please login or register to see the full article








