ApplyUpdates does not always update database correctly

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
yozey
Posts: 32
Joined: Sat 17 Jan 2009 14:41

ApplyUpdates does not always update database correctly

Post by yozey » Fri 16 Jul 2010 01:30

Hi I'm having an issue with TPgTable and ApplyUpdates. What is happening is that if I change a value in a field and call ApplyUpdates the field is changed in the underlying dataset. However if I immediately change the value back to it's original value, the ApplyUpdates does not change it. I confirmed this by monitoring the SQL statement created and sent to the server. On the second update the field that is changed to the original value is not included in the SQL statement.

What would be the cause of this?

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Fri 16 Jul 2010 12:34

Hello

By default DAC dataset stores fields that were changed only. If you change the value back, then dataset will consider that this field was not changed.

If you want to save all fields in any case, then you should set the Options.UpdateAllFields option to True.

yozey
Posts: 32
Joined: Sat 17 Jan 2009 14:41

Post by yozey » Fri 16 Jul 2010 12:45

This works! Thank you.

Post Reply