1
0
mirror of synced 2024-12-22 17:23:07 +01:00

Fixed: attempt to read back variants as the correct type

This commit is contained in:
Mark van Renswoude 2011-03-29 09:05:11 +00:00
parent cb92eabcf1
commit c8f791fce5

View File

@ -283,9 +283,22 @@ var
value: IXMLvalue; value: IXMLvalue;
begin begin
Result := GetValue(AName, value, False) and (value.Hasvariant); Result := GetValue(AName, value, False);
if Result then if Result then
begin begin
if value.Hasinteger then
AValue := value.integer
else if value.Hasfloat then
AValue := value.float
else if value.Has_string then
AValue := value._string
else if value.Hasint64 then
AValue := value.int64
else if value.Hasvariant then
if value.variantIsNil then if value.variantIsNil then
AValue := Null AValue := Null
else else
@ -376,10 +389,31 @@ begin
begin begin
if VarIsNull(AValue) or VarIsClear(AValue) then if VarIsNull(AValue) or VarIsClear(AValue) then
value.variantIsNil := True value.variantIsNil := True
else
begin
case VarType(AValue) of
varSmallint,
varInteger:
value.Integer := AValue;
varSingle,
varDouble,
varCurrency:
value.float := AValue;
varInt64:
value.Int64 := AValue;
varOleStr,
varStrArg,
varString:
value._string := AValue;
else else
value.variant := AValue; value.variant := AValue;
end; end;
end; end;
end;
end;
function TX2UtPersistXMLFiler.WriteStream(const AName: string; AStream: TStream): Boolean; function TX2UtPersistXMLFiler.WriteStream(const AName: string; AStream: TStream): Boolean;