View Issue Details

IDProjectCategoryView StatusLast Update
0007295FPCDatabasepublic2007-04-13 22:23
ReporterMartin SchreiberAssigned ToJoost van der Sluis 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version2.0.4Product Build 
Target VersionFixed in Version2.2.0 
Summary0007295: TBufDataset in dsCalcFields state
DescriptionIt is not possible to set field data in TBufDataset in dsCalcFields state:

procedure TBufDataset.SetFieldData(Field: TField; Buffer: Pointer);

var CurrBuff : pointer;
    NullMask : pbyte;

begin
  if not (state in [dsEdit, dsInsert, dsFilter]) then //<<<<<<<<<--!!!
    begin
    DatabaseErrorFmt(SNotInEditState,[NAme],self);
    exit;
    end;
[...]

And there is no storage of fields with Fieldno = 0.
Please see TDbf.SetFieldData for an example.
TagsNo tags attached.
Fixed in Revision5775
FPCOldBugId0
FPCTarget
Attached Files

Relationships

related to 0007294 closedJoost van der Sluis TBufDataset does not fire OnCalcFields 
related to 0007157 feedbackJoost van der Sluis InternalCalcFields are not implemented 

Activities

Joost van der Sluis

2006-08-26 00:00

manager   ~0008768

I did an attempt based on the tDbf example to get it working in revision 4506 (2.1.1) Can you test if this works?

I also saw in the Delhi help that OnCalcRecords should be called if the dataset is opened. I think that that's not the case in fpc, can you conform this, and is this really necessary?

Martin Schreiber

2006-08-26 20:26

reporter   ~0008773

No it doesn't work.
There must be space reserved in the TDataset record buffer for the calc fields and TBufDataset.GetFieldData and SetFieldData must move the data from/to the correct offset in the buffer. If I read the code right, the record buffer provided by TBufDataset holds only the fields of the query listed in FieldDefs.
For "InternalCalcFields" there must additionally be space reserved in the linked record list, "InternalCalcFields" are like normal data fields but are not transferred from/to database. The values of "CalcFields" are lost if the record scrolls out of the TDataset buffer window. I hope i am right with this info. :-)
About OnCalcRecords calling on dataset open, it should be called on an empty dataset too. I do not know if it is guaranteed in FPC.

Joost van der Sluis

2007-01-01 22:11

manager   ~0010607

Calculated fields are implemented now. For internal-calculated fields see bug 7157.

About OnCalcRecords being called on dataset.open of an empty dataset. I tested that with Delphi and there it isn't called. All calculated fields are simply cleared. Fpc does the same.

Issue History

Date Modified Username Field Change
2006-08-22 14:01 Martin Schreiber New Issue
2006-08-22 14:32 Joost van der Sluis Status new => assigned
2006-08-22 14:32 Joost van der Sluis Assigned To => Joost van der Sluis
2006-08-25 23:58 Joost van der Sluis Relationship added related to 0007294
2006-08-26 00:00 Joost van der Sluis Note Added: 0008768
2006-08-26 00:00 Joost van der Sluis Status assigned => feedback
2006-08-26 20:26 Martin Schreiber Note Added: 0008773
2006-10-18 10:20 Marco van de Voort Old bug id => 0
2006-10-18 10:20 Marco van de Voort Category FCL => Database Components
2007-01-01 21:29 Joost van der Sluis Relationship added related to 0007157
2007-01-01 22:11 Joost van der Sluis Fixed in Revision => 5775
2007-01-01 22:11 Joost van der Sluis Status feedback => resolved
2007-01-01 22:11 Joost van der Sluis Fixed in Version => 2.1.1
2007-01-01 22:11 Joost van der Sluis Resolution open => fixed
2007-01-01 22:11 Joost van der Sluis Note Added: 0010607
2007-04-13 22:23 Florian Status resolved => closed