Variant conversion Fail for Int64/LargeInt
Posted: 03.04.2012, 16:55
We know VInteger defined as Int64 but after I search at Unit ZVariant.pas Starting at Line 1081 convertion for Vint From String and attach using Integer conversion
CMIIW
Code: Select all
vtInteger:
case Value.VType of
vtNull:
Result.VInteger := 0;
vtBoolean:
if Value.VBoolean then
Result.VInteger := 1
else Result.VInteger := 0;
vtInteger:
Result.VInteger := Value.VInteger;
vtFloat:
Result.VInteger := Trunc(Value.VFloat);
vtString:
Result.VInteger := StrToInt64Def(Value.VString, 0); //StrToIntDef(Value.VString, 0);
vtUnicodeString:
Result.VInteger := StrToInt64Def(Value.VUnicodeString, 0);//StrToIntDef(Value.VUnicodeString, 0);
vtDateTime:
Result.VInteger := Trunc(Value.VDateTime);
vtPointer:
Result.VInteger := Int64(Value.VPointer);//Integer(Value.VPointer);
vtInterface:
RaiseTypeMismatchError;
end;