Discussion:
Delphi 7 TSimpleDataSet & how to exclude fields from the where clause
(too old to reply)
Victor Zajac
2008-04-22 18:02:01 UTC
Permalink
I'm using Delphi 7, Firebird 2.0.3, TSimpleDataSet. One of the fields is of TimeStamp type, and a before insert trigger sets its value to current_timestamp. When I intend to apply updates after deleting a record, a 'Record not found or changed by another user' exception is raised. I think the problem is the conversion between Delphi format of a timestamp and the actual value stored in the table, so I only want to exclude that field from the where clause in updates and deletes. How can I do that using TSimpleDataSet? Thanks in advance.
Bill Todd [TeamB]
2008-04-22 21:02:46 UTC
Permalink
This is one of many reasons to never use TSimpleDataSet.

Replace the TSimpleDataSet with separate TSQLDataSet, TDataSetProvider
and TClientDataSet components.

Instantiate the field opjects for the TSQLDataSet at design time using
the fields editor.

Select the field you want to exclude from the WHERE clause and set it
ProviderFlags property pfInWhere to false.

A better solution that also handles changes to blobs is to add a
row_version field to each table. Create before insert and before update
triggers that increment the row version column using a generator. Then
exclude all colums from the WHERE clause except the primary key and the
row version.
--
Bill Todd (TeamB)
Loading...