Page 1 of 1

Updtae failed. Found 0 records.

Posted: Wed 16 Sep 2009 07:07
by benek
Hi,

I have some tables updated via views (view triggers). In one case I get constantly an error message
"Updtae failed. Found 0 records." What may be the reason ?

IBDAC 3.10.0.7 / Firebird 2.1.2

Posted: Wed 16 Sep 2009 08:01
by Plash
This error is raised if the RowsAffected property is 0 after the update query is executed.

If your table is updated successfully but you get this error, set the StrictUpdate option of TIBCQuery to False to disable checking RowsAffected.

Posted: Wed 16 Sep 2009 09:10
by benek
The application is connected to views via TIBCTables. Each view directly in the database has beforeupdate trigger and IT updates the table actually. Usually it works all right, with one exception. The table which generates exception looks like the others, nothing special. All TIBCTables properties are set the same. It looks like the database file isn't corrupted too. Directly in the database the update works correctly . So.. any other hints ? 8)

Posted: Thu 17 Sep 2009 07:49
by Plash
Just set the StrictUpdate option to False.

Posted: Thu 17 Sep 2009 09:53
by benek
Seting StrictUpdate option to False doesn't help. Error message disappears but the record isn't actually updated or deleted.

I have walked around the problem with TIBCUpdateSQL as UpdateObject in TIBCTable.

I've noticed the problem occurs when a field of type numeric(15,9) has any positive value. When null or 0 there's no problem. When positive it looks like the delete or update trigger in database doesn't see any params (??)

Posted: Fri 18 Sep 2009 07:20
by Plash
Probably the problem is related to the code of your triggers.

Posted: Sat 19 Sep 2009 14:59
by benek
Before delete trigger looks like that:

CREATE TRIGGER MY_TRIGGER FOR TABLE
ACTIVE BEFORE DELETE POSITION 0
AS
begin
DELETE FROM TABLE WHERE ID = OLD.ID;
end


not too complicated :)

Posted: Mon 21 Sep 2009 08:02
by Plash
Maybe the problem occurs because DELETE query is executed twice:
First in the trigger, then the server tries to delete the record because it executes the main DELETE query that was sent by TIBCTable.