You are not logged in.
Hi AB,
We've added in GetFieldData for TSynVirtualDataSet the handle for Currency field (same as ftFloat) and corrected DateTime with which we had problems in conversions. Handle 30/12/1899 date as NULL.
Here is our overriden code integrated within getFieldData in SynVirtualDataSet.
begin
result := false;
OnlyTestForNull := (Buffer=nil);
RowIndex := PRecInfo(ActiveBuffer).RowIndentifier;
Data := GetRowFieldData(Field,RowIndex,DataLen,OnlyTestForNull);
if Data=nil then // on success, points to Int64,Double,Blob,UTF8
exit;
result := true;
if OnlyTestForNull then
exit;
Dest := pointer(Buffer); // works also if Buffer is [var] TValueBuffer
case Field.DataType of
ftBoolean:
PWORDBOOL(Dest)^ := PBoolean(Data)^;
ftInteger:
PInteger(Dest)^ := PInteger(Data)^;
ftLargeint, ftFloat, ftCurrency:
PInt64(Dest)^ := PInt64(Data)^;
ftDate,ftTime,ftDateTime: begin
if PDateTime(Data)^ = 0 then begin
result := false;
exit;
end;
DataConvert(Field,Data,Dest,true);
end;
ftString: begin
if DataLen<>0 then begin
CurrentAnsiConvert.UTF8BufferToAnsi(Data,DataLen,Temp);
DataLen := length(Temp);
MaxLen := Field.DataSize-1; // without trailing #0
if DataLen>MaxLen then
DataLen := MaxLen;
move(pointer(Temp)^,Dest^,DataLen);
end;
PAnsiChar(Dest)[DataLen] := #0;
end;
ftWideString: begin
{$ifdef ISDELPHI2007ANDUP} // here Dest = PWideChar[] of DataSize bytes
if DataLen=0 then
PWideChar(Dest)^ := #0 else
UTF8ToWideChar(Dest,Data,(Field.DataSize-2)shr 1,DataLen);
{$else} // here Dest is PWideString
UTF8ToWideString(Data,DataLen,WideString(Dest^));
{$endif}
end;
// ftBlob,ftMemo,ftWideMemo should be retrieved by CreateBlobStream()
else raise EDatabaseError.CreateFmt('%s.GetFieldData DataType=%d',
[ClassName,ord(Field.DataType)]);
end;
end;
We would be glad if you think this is relevant.
Thanks.
edit: If you use this patch, I think DateTimeToNative inside SynVirtualDataset isn't used anymore.
Last edited by StxLog (2017-02-13 10:48:01)
Offline
Please check https://synopse.info/fossil/info/232b1769f8
Offline
Offline
Thanks your great support ab;
Now; version 25-07-2017 reading correct datetime value from MSSQL 2008 R2 database.
this version solve ".. is not datetime value" error message.
Last edited by zekeriye (2017-07-26 10:00:17)
Offline