Updating Data with PgDAC Dataset Components

PgDAC dataset components which descend from TCustomDADataSet provide different ways for reflecting local changes on the server.

The first approach is to use automatic generation of update SQL statements. When using this approach you should specify Key Fields (the KeyFields property) to avoid requesting KeyFields from the server. When SELECT statement uses multiple tables, you can use the P:Devart.PgDac.TCustomPgDataSet.UpdatingTable property to specify which table will be updated. If UpdatingTable is blank, the first table of the FROM clause will be used. In the most cases PgDAC needs an additional information about updating objects. So PgDAC executes additional queries to the server. This helps to generate correct updating SQL statements but may result in performance decrease. To disable these additional queries, set the ExtendedFieldsInfo option to False.

Another approach is to set update SQL statements using SQLInsert, SQLUpdate, and SQLDelete properties. Use them to specify SQL statements that will be used for corresponding data modifications. It is useful when generating data modification statements is not possible (for example, when working with data returned by a stored procedure) or you need to execute some specific statements. You may also assign the TPgUpdateSQL component to the UpdateObject property. TPgUpdateSQL component holds all updating SQL statements in one place. You can generate all these SQL statements using PgDAC design time editors. For more careful customization of data update operations you can use InsertObject, ModifyObject and DeleteObject properties of the TPgUpdateSQL component.

See Also

© 1997-2022 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback