problem with TDateTimeField
I have problem reading DateTime values from our database, because fastcube tries to translate them from MSec to TDateTime - but in our database DateTime values are already stored as TDateTime.
function TPDateTimeArray.Hash(AValue: Pointer): Word;
var
T: TTimeStamp;
begin
T := MSecsToTimeStamp(PDouble(AValue)^);
// T := DateTimeToTimeStamp(PDouble(AValue)^);
// T.Time := 0; //??? ?? ?¤?® ???«?? ????? ???
PDouble(AValue)^ := TimeStampToDateTime(T);
Result := Abs(PInt64(AValue)^ mod Frazm);
end;
in our case this would work:
function TPDateTimeArray.Hash(AValue: Pointer): Word;
begin
Result := Abs(PInt64(AValue)^ mod Frazm);
end;
function TPDateTimeArray.Hash(AValue: Pointer): Word;
var
T: TTimeStamp;
begin
T := MSecsToTimeStamp(PDouble(AValue)^);
// T := DateTimeToTimeStamp(PDouble(AValue)^);
// T.Time := 0; //??? ?? ?¤?® ???«?? ????? ???
PDouble(AValue)^ := TimeStampToDateTime(T);
Result := Abs(PInt64(AValue)^ mod Frazm);
end;
in our case this would work:
function TPDateTimeArray.Hash(AValue: Pointer): Word;
begin
Result := Abs(PInt64(AValue)^ mod Frazm);
end;
Comments
Please write:
-database type
-dataset component
-type of field in database
-type of field component in Delphi for this field
-Delphi version
Oleg.
Hi Oleg,
thanks, I found the problem. The database is our own dbGonzales Database Server. DateTime Fields in the Database have the same format as the TDateTime type in Delphi (= Double). Because of that we don't need to convert from MSec to TImeStamp and from TimeStamp to TDateTime. This leeds to a wrong implementation of GetFieldData(Field, Buffer, NativeFormat) in the case of NativeFormat = true.
FastCube is the first component we tested which called GetFieldData with NativeFormat= true directly.
Sorry to bother you, with our own fault.
Cheers,
Adrian.