When debugging: TableEvent returns false, but record saves

Hi all,

In my database I have an integer field called ‘locked’.
I have attached a method to the onUpdate table event which returns false if locked = 1.

This works fine in Developer except when I switch the debugger on. Then the record saves even if my method returns false…

Anybody else seen this issue?

Developer 3.5.3-build 516
Java 1.5.0_13_119 (Mac OS X)

Are you using start/commit/rollback transaction?

databaseManager.startTransaction()

var _ok = databaseManager.saveData()

if (_ok)
     databaseManager.commitTransaction()
else
     databaseManager.rollbackTransaction();

I use lot of these situations, and never noticed that my record was saved, unless it didn’t pass by a rollback.

martinh:

databaseManager.startTransaction()

var _ok = databaseManager.saveData()

if (_ok)
databaseManager.commitTransaction()
else
databaseManager.rollbackTransaction();

Hi Martin,

No, I’m not using transactions yet.

I was going to ask whether Servoy automatically adds a transaction round a databaseManager.saveData() call… What happens if a save sets off a chain of updates through table events and something event method fails or returns false?

As far as I know, Servoy doesn’t use automatically transactions.

I think as long as you don’t do a saveData(), then you can use databaseManager.rollbackEditedRecords()

But for doing a rollback of updates made in table-events, you must use transactions. It works like that, I’m sure, I’m using the same technology.

If you do that, you will see that with version 3.5.3 that on rollback, you get the same error message ‘your field is locked’ from your table event, but this will be fixed in 3.5.4