I use TDBF extensively in my Accounting project front end to firebird .
The assignment to "result" as below is not robust as it will reject a Tdatetime that has zero time element.
******************************************************************************************************************
Result := (Unaligned(PInteger(Src)^) <> 0) and (Unaligned(PInteger(PChar(Src)+4)^) <> 0);
******************************************************************************************************************
SEE ALTERED SOURCE BELOW- THERE IS A ROBUSTNESS ISSUE
as the function GetFieldDataFromDef requires a time value other than zero to process correctly where FDateTimeHandling is set to dtDateTime .
Regards - David Parnaby - Durban
***************************************************************************************************************
Source DBF_DBFFile starts line 1697
function TDbfFile.GetFieldDataFromDef(AFieldDef: TDbfFieldDef; DataType: TFieldType;
Src, Dst: Pointer; NativeFormat: boolean): Boolean;
'@':
begin
{*********************in house amendments***********************}
if FDateTimeHandling = dtBDETimeStamp then
begin
Result := (Unaligned(PInteger(Src)^) <> 0) and (Unaligned(PInteger(PChar(Src)+4)^) <> 0);
if Result and (Dst <> nil) then
begin
SwapInt64BE(Src, Dst);
date := BDETimeStampToDateTime(PDouble(Dst)^);
SaveDateToDst;
end;
end else
if FDateTimeHandling = dtDateTime then
begin
//-Takenout->
******************************************************************************************************************
// Result := (Unaligned(PInteger(Src)^) <> 0) and (Unaligned(PInteger(PChar(Src)+4)^) <> 0);
******************************************************************************************************************
if (Dst <> nil) then
begin
SwapInt64BE(Src, Dst);
{ zero date can cause exceptions }
if Unaligned(PInteger(Src)^) =0 then
date:=1 else
date := PDateTime(Dst)^;
SaveDateToDst;
end;
end;
{*********************in house amendments***********************}