databaseManager.saveData() loophole?

Here’s the scenario:

Servoy 4.1.1, sybase ASA 10, autoSave is off.

  • User enters data on a form and hits my ‘Save’ button
  • databaseManager.saveData() returns false
  • getFailedRecords reveals that the user has entered an invalid foreign key, and servoy_log.txt contains a corresponding db error entry
  • I display an error message but I leave the user in edit mode.
  • User hits ‘Save’ again without making any changes to the form (user is a persistent little bastard)
  • databaseManager.saveData returns TRUE!
  • No errors reported in servoy_log

As you can imagine, this loophole makes it difficult to do robust error handling.

What am I missing?

Thanks for your help.

Hi Adrian,

I discovered this loophole to and created a case for it.

Servoy’s answer was :

databaseManager.commtTransaction will return false if there are failed records
so save succeeds for the outstanding records but as long there are failed records present its impossible to have commtTransaction returning true

Many developers do not provide any means to resolve an error (by end user) on an failed record (especially when record is created via scripting)
Therefor we supplied a method to retreive all records with errors, see: databaseManager.getFailedRecords()

They will not fix this. (status closed-Won’t-fix)

So the best thing to do is check for failed Records and use transactions ( start just before save and commit or rollback after it)

Regards,

Hans