Updtae failed. Found 0 records.

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
benek
Posts: 20
Joined: Sun 06 Jul 2008 14:22

Updtae failed. Found 0 records.

Post by benek » Wed 16 Sep 2009 07:07

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 16 Sep 2009 08:01

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.

benek
Posts: 20
Joined: Sun 06 Jul 2008 14:22

Post by benek » Wed 16 Sep 2009 09:10

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)

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 17 Sep 2009 07:49

Just set the StrictUpdate option to False.

benek
Posts: 20
Joined: Sun 06 Jul 2008 14:22

Post by benek » Thu 17 Sep 2009 09:53

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 (??)

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 18 Sep 2009 07:20

Probably the problem is related to the code of your triggers.

benek
Posts: 20
Joined: Sun 06 Jul 2008 14:22

Post by benek » Sat 19 Sep 2009 14:59

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 :)

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 21 Sep 2009 08:02

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.

Post Reply