View Issue Details

IDProjectCategoryView StatusLast Update
0033080FPCDatabasepublic2018-09-23 17:09
ReporterMichal GawryckiAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product VersionProduct Build37892 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033080: TDataSet.Resync - remove InternalInitRecord(ActiveBuffer)
DescriptionCalling InternalInitRecord(ActiveBuffer) function is incorrect for "TDataSet.Resync".
Delphi documentation says that InternalInitRecord is called only by InitRecord and ClearFields.

http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.DB.TDataSet.InternalInitRecord
TagsNo tags attached.
Fixed in Revision38066
FPCOldBugId
FPCTarget
Attached Files
  • resync-dataset.inc.patch (528 bytes)
    Index: packages/fcl-db/src/base/dataset.inc
    ===================================================================
    --- packages/fcl-db/src/base/dataset.inc	(revision 37892)
    +++ packages/fcl-db/src/base/dataset.inc	(working copy)
    @@ -2133,8 +2133,6 @@
     {$endif}
           // nothing found, invalidate buffer and bail out.
           ClearBuffers;
    -      // Make sure that the active record is 'empty', ie: that all fields are null
    -      InternalInitRecord(ActiveBuffer);
           DataEvent(deDatasetChange,0);
           exit;
           end;
    

Activities

Michal Gawrycki

2018-01-26 21:16

reporter  

resync-dataset.inc.patch (528 bytes)
Index: packages/fcl-db/src/base/dataset.inc
===================================================================
--- packages/fcl-db/src/base/dataset.inc	(revision 37892)
+++ packages/fcl-db/src/base/dataset.inc	(working copy)
@@ -2133,8 +2133,6 @@
 {$endif}
       // nothing found, invalidate buffer and bail out.
       ClearBuffers;
-      // Make sure that the active record is 'empty', ie: that all fields are null
-      InternalInitRecord(ActiveBuffer);
       DataEvent(deDatasetChange,0);
       exit;
       end;

Thaddy de Koning

2018-01-26 22:00

reporter   ~0106056

On examining the code from an -admittedly older- delphi version XE2 and FPC it strikes me that the patch may not be correct because the internals between FPC's implementation and the one in Delphi differ too much. The code works transparent, but the internals differ a great deal. Please provide examples and tests.

Michal Gawrycki

2018-01-26 23:25

reporter   ~0106058

It will be difficult to show it on an example but I will try to explain it. InternalInitRecord should only be called when buffer for new record is created or when clearing edit buffer of active record (by calling ClearFields but only for State in dsEditModes, otherwise it should throw an exception).
If invoked in Resync, a record buffer is being cleared, but it may contain additional internal data for record, which in this case are destroyed.
So I think that we should not touch record buffer in TDataSet.Resync.
And in practice I have a problem with MDO/IBX related to this issue.

Michael Van Canneyt

2018-01-28 11:39

administrator   ~0106088

I tested, and the patch does not cause a regression in the testsuite.

The patch is applied, thank you.

Michal Gawrycki

2018-09-23 17:09

reporter   ~0110981

Thanks. Closed.

Issue History

Date Modified Username Field Change
2018-01-26 21:16 Michal Gawrycki New Issue
2018-01-26 21:16 Michal Gawrycki File Added: resync-dataset.inc.patch
2018-01-26 22:00 Thaddy de Koning Note Added: 0106056
2018-01-26 23:25 Michal Gawrycki Note Added: 0106058
2018-01-28 11:39 Michael Van Canneyt Fixed in Revision => 38066
2018-01-28 11:39 Michael Van Canneyt Note Added: 0106088
2018-01-28 11:39 Michael Van Canneyt Status new => resolved
2018-01-28 11:39 Michael Van Canneyt Fixed in Version => 3.1.1
2018-01-28 11:39 Michael Van Canneyt Resolution open => fixed
2018-01-28 11:39 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-01-28 11:39 Michael Van Canneyt Target Version => 3.2.0
2018-09-23 17:09 Michal Gawrycki Note Added: 0110981
2018-09-23 17:09 Michal Gawrycki Status resolved => closed