# databaseManager.saveData() loophole?

**URL:** <https://forum.servoy.com/t/databasemanager-savedata-loophole/10438>\
**Category:** Classic Servoy\
**Created:** [March 17, 2009, 11:37pm UTC](https://forum.servoy.com/t/databasemanager-savedata-loophole/10438 "2009-03-17T23:37:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amcgilly](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@amcgilly](https://forum.servoy.com/u/amcgilly)\
**Post date:** [March 17, 2009, 11:37pm UTC](https://forum.servoy.com/t/databasemanager-savedata-loophole/10438/1 "2009-03-17T23:37:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hans\_Nieuwenhuis](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@Hans\_Nieuwenhuis](https://forum.servoy.com/u/Hans_Nieuwenhuis)\
**Post date:** [March 18, 2009, 9:28am UTC](https://forum.servoy.com/t/databasemanager-savedata-loophole/10438/2 "2009-03-18T09:28:08Z")

</div>

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
