View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037900 | FPC | Database | public | 2020-10-09 14:46 | 2020-10-12 10:46 |
Reporter | Tony Whyman | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | x86_64 | OS | Linux | ||
Product Version | 3.0.4 | ||||
Summary | 0037900: INSERT into an empty dataset fails to set BOF to false | ||||
Description | The TDataset.Append method may be used to insert a record into an empty database or to add a record to a non-empty database. It should similarly be possible to use the TDataset.Insert method to add a record to an empty database. However, this is not possible as there appears to be a bug in the internal TDataset.DoInsertAppend method which, while setting FBof to false when called via TDataset.Append, leaves it set to true when called via TDataset.Insert. As a result TDataset.IsEmpty always returns true and it is impossible to read from the dataset. Field data is thus always null. TDataset.Append can always used as a workaround for a bidirectional database. However, this is not possible for a unidirectional dataset as a call to TDataset.Append always results in an exception reporting that the action is not permitted for a unidirectional dataset. | ||||
Steps To Reproduce | This problem is easily demonstrated with any editable TDataset descendent after an empty dataset is opened. First invoke: Append; writeln(outfile,'BOF = ',BOF,', EOF = ',EOF); This should show BOF = false, EOF = true. Then invoke Insert; writeln(outfile,'BOF = ',BOF,', EOF = ',EOF); This returns BOF=true, EOF = true. | ||||
Additional Information | The fix is probably as simple as adding FBof := false to the DoInsertAppend method. I.e. If Not DoAppend then begin {$ifdef dsdebug} Writeln ('going to insert mode'); {$endif} DoInsert(false); FBof := false; //Proposed bug fix end else begin ... | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2020-10-09 14:46 | Tony Whyman | New Issue | |
2020-10-12 10:46 | LacaK | Note Added: 0126252 |