Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Midas/TClientDataSet    [ Add a report in this area ]  
Report #:  3660   Status: Closed
Backwards compatibility issue/feature change with midas.dll from D7.
Project:  Delphi Build #:  7.0.4.453
Version:    7.0 Submitted By:   Craig Stuntz
Report Type:  Minor failure / Design problem Date Reported:  3/3/2003 7:28:21 AM
Severity:    Infrequently encountered problem Last Updated: 12/15/2006 4:03:01 AM
Platform:    95, 98, 2000, NT, XP Internal Tracking #:   156503
Resolution: Fixed (Resolution Comments) Resolved in Build: : 7.0.8.1
Duplicate of:  None
Voting and Rating
Overall Rating: (2 Total Ratings)
4.00 out of 5
Total Votes: None
Description
Reported by Anders Melander on borland.public.delphi.database.multi-tier

In versions of midas.dll prior to v7, it was possible to cancel an update to an individual field by assigning the "unassigned" (varEmpty) value to TField.NewValue in the TDataSetProvider.BeforeUpdateRecord event handler.

With Delphi 7 this method no longer works as "unassigned" is interpreted by midas.dll as the NULL value.
Steps to Reproduce:
Open the attached application and follow the steps given there.
Workarounds
The following function can be used to cancel the update of a single TClientDataSet field and has been verified to work with midas.dll v5-7.

type
  TClientDataSetCracker = class(TClientDataSet);

procedure UndoField(Field: TField);
begin
  TClientDataSetCracker(Field.DataSet).DSBase.PutBlank(Field.DataSet.ActiveBuffer,
    0, Field.Index+1, BLANK_NOTCHANGED);
end;

The function should be considered a work around as it relies on undocumented MIDAS internals.

---------

The following function can be used to cancel the update of a single TClientDataSet field and has been verified to work with midas.dll v5-7.

type
  TClientDataSetCracker = class(TClientDataSet);

procedure UndoField(Field: TField);
begin
  TClientDataSetCracker(Field.DataSet).DSBase.PutBlank(Field.DataSet.ActiveBuffer,
    0, Field.Index+1, BLANK_NOTCHANGED);
end;

The function should be considered a work around as it relies on undocumented MIDAS internals.
Attachment
None
Comments

None

Server Response from: CODE1