I’ve noticed that in some cases a databaseManager.rollBackEditedRecords() deletes previously saved records
Step 1) insert some new records (A)
2) databaseManager.saveData()
3) databaseManager.setAutoSave(false)
4) insert some new records (B)
5) databaseManager.rollBackEditedRecords()
6) databaseManager.setAutoSave(true)
Records A and B are gone after step 6. No Servoy database transactions are active.
I went into debug mode : The saveData() of step 2 returns true, databaseManager.getEditedrecords() is empty after the save and I see the records (A) in the data SQL explorer (as it should after saveData()) !
After step 6 and refreshing the data SQL explorer the records (A) are gone… If I don’t use the rollbackEditedRecords() (step 5) everything is fine…
Quite disturbing. It looks like the internal Servoy administration of edited records is not (yet ?) correctly updated.
There must be something else going on, because databasemanager.rollbackEditedrecords() does not delete anything in the db, it just reverts changes made in memory.
I filed a case but I don’t have the time to isolate the problem into a sample solution.
I rewrote my code now so that I don’t have to use the rollbackEditedRecords() in step 5 (first test and if ok then write is BTW always better)
Interesting…so they are in the database and then gets deleted. Are you sure you don’t use a DB transaction that you rollback ?
Also check the statistics page in the Servoy admin pages to see if there is a delete.