View Issue Details

IDProjectCategoryView StatusLast Update
0036164LazarusDatabase Componentspublic2019-12-13 01:55
ReporterAndersonAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version2.0.4Product Build 
Target VersionFixed in Version 
Summary0036164: TDBEdit.Modified is not setting
DescriptionThe "Modified" property is not setting to true after making a change to an TDBEdit component.
Steps To ReproduceSee sample or just try something like:

  if DBEditDBF.Modified then
    ShowMessage('DBF Modified')
  else
    ShowMessage('DBF NOT Modified');

Made a sample code using IBX, Memdataset and TDBF
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Relationships

related to 0031820 assignedJuha Manninen TDBEdit.Modified property don't reset after DataSet.Post 

Activities

Anderson

2019-10-11 18:37

reporter  

modified.zip (200,191 bytes)

Anderson

2019-11-07 15:01

reporter   ~0119136

tested with Lazarus 2.0.6 and the bug stills there

Juha Manninen

2019-11-13 00:03

developer   ~0119249

I am not sure if the "Modified" property should be set for any DB aware controls. The DB itself is modified, not the control connecting to it.
A DB expert should comment on this one.

Anderson

2019-11-23 13:12

reporter   ~0119448

Hi Juha Manninen, thx for your comment

I have a project running on Lazarus 1.8 and the Modified is stetted normally.

I have a logic the use "onExit" and "Modified" to do some stuff. On Lazarus 1.8 and early it's works good... on 2.0+ no..
I'm stuck on 1.8..

Anderson

2019-12-04 19:21

reporter   ~0119616

Hello, found the issue related: https://bugs.freepascal.org/view.php?id=31820

The problem is that "TDBEdit.UpdateData" is called after every change on the TDBEdit, so the "Modified := False;" is always executed...

If I remove the "Modified := False;" my code works fine.

Juha Manninen

2019-12-05 00:28

developer   ~0119617

Last edited: 2019-12-05 19:39

View 3 revisions

> The problem is that "TDBEdit.UpdateData" is called after every change on the TDBEdit
Do you mean after every keypress? Then it is called too often.

Please see the note by Soner in the related issue:
 https://bugs.freepascal.org/view.php?id=31820#c103362
which is perfectly valid.
Making decisions based on TDBEdit.Modified is logically wrong. TField.Modified would indeed make more sense but implementing it may be tricky. Somebody with good DB knowledge should comment on this one.
[Edit] I reopened the related issue. Maybe we should indeed revert r56034 unless somebody comes up with a better solution.
The question is: If the Modified flag is not useful, why Andrey Korol and Soner wanted to reset it in the first place?

Ideal solution would be to reset TDBEdit.Modified only after DataSet.Post.

Anderson

2019-12-06 22:12

reporter   ~0119668

Hi Juha Manninen thx for your answer.
I know it's not the best to use TDBEdit.Modified, but i'ts work for my logic.. I have a "refresh data" that is called at onExit, to optimize I call It only when it's "Modified"..

Now talking about TField.Modified it would be awesome..
I have a code in Delphi that checks "TField.OldValue" and "TField.NewValue" at DataSet.OnBeforePost for audit purposes, tried to replicate with Lazarus.. but the OldValue and NewValue are always the same...

Juha Manninen

2019-12-06 22:56

developer   ~0119669

> but the OldValue and NewValue are always the same...
Ohh! Could you please study the code and fix it? I don't personally work much with DBs.

Anderson

2019-12-07 00:02

reporter   ~0119670

Sure, I can try

Anderson

2019-12-13 01:55

reporter   ~0119810

Hi Juha Manninen

About the old/new value thing.. I need to make some changes on the DB.pas file..

This file is part of FPC and not Lazarus right?

Issue History

Date Modified Username Field Change
2019-10-11 18:37 Anderson New Issue
2019-10-11 18:37 Anderson File Added: modified.zip
2019-11-07 15:01 Anderson Note Added: 0119136
2019-11-13 00:03 Juha Manninen Note Added: 0119249
2019-11-23 13:12 Anderson Note Added: 0119448
2019-12-04 19:21 Anderson Note Added: 0119616
2019-12-04 23:49 Juha Manninen Relationship added related to 0031820
2019-12-05 00:28 Juha Manninen Note Added: 0119617
2019-12-05 00:28 Juha Manninen Assigned To => Juha Manninen
2019-12-05 00:28 Juha Manninen Status new => feedback
2019-12-05 00:28 Juha Manninen LazTarget => -
2019-12-05 00:32 Juha Manninen Note Edited: 0119617 View Revisions
2019-12-05 19:39 Juha Manninen Note Edited: 0119617 View Revisions
2019-12-06 22:12 Anderson Note Added: 0119668
2019-12-06 22:12 Anderson Status feedback => assigned
2019-12-06 22:56 Juha Manninen Note Added: 0119669
2019-12-07 00:02 Anderson Note Added: 0119670
2019-12-13 01:55 Anderson Note Added: 0119810