Migrating BDE TDBDataset's UpdateMode property to SDAC

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lcoelho
Posts: 47
Joined: Wed 13 Apr 2011 13:41

Migrating BDE TDBDataset's UpdateMode property to SDAC

Post by lcoelho » Wed 27 Apr 2011 11:36

In BDE, the dataset components (TQuery, TTable and TStoredProc) have a property called 'UpdateMode'.

This property determines how the Borland Database Engine (BDE) finds records when updating to an SQL database. UpdateMode allows one to specify the criteria to use when locating a record in the dataset for an update query; it specifies whether modified records are located based on all fields (UpdateMode = upWhereAll), on only the key fields (UpdateMode = upWhereKeyOnly), or on the key fields plus the original values of fields that have been modified (UpdateMode = upWhereChanged).

I see from the SDAC documentation that UpdateMode is not a supported property with the SDAC dataset components and that the default behaviour corresponds with the upWhereKeyOnly UpdateMode (on only the key fields).

Could you please inform me how to achieve the upWhereChanged (on the key fields plus the original values of fields that hve been modified) mode using SDAC? I have read something about using CheckRowVersion but am not sure if this will achive the same results as upWhereChanged and am not sure hot to implement.

Thank you for your kind assistance.

AndreyZ

Post by AndreyZ » Wed 27 Apr 2011 13:35

Hello,

SDAC generates update statements in the most efficient way: an update statement contains SET statements only for fields that were changed, and only with the primary key in the WHERE part. Only in case when a table doesn't have primary key, update statement is generated with all fields in the WHERE part. Also you can use the KeyFields property to make SDAC generate an update statement with all fields from the KeyFields property in the WHERE part.

lcoelho
Posts: 47
Joined: Wed 13 Apr 2011 13:41

Post by lcoelho » Thu 28 Apr 2011 10:41

Hi AndreyZ,

Thanks once again for your quick response to my query. In other words, if I'm migrating from BDE to SDAC, I can merely remove the UpdateMode property from the migrated dataset components. Is that correct?

AndreyZ

Post by AndreyZ » Thu 28 Apr 2011 11:26

Yes, you can remove the UpdateMode property.

Post Reply