You are not logged in.
Pages: 1
Hi!
I have idea for custom RTTI PropInfo for custom types. Patch attached:
(moved below)
Example usage:
type
TDouble_Precision2 = type Double;
TSQLPropInfoRTTIDouble_Precision2 = class(TSQLPropInfoRTTIDouble)
public
procedure GetValueVar(Instance: TObject; ToSQL: boolean;
var result: RawUTF8; wasSQLString: PBoolean); override;
end;
implementation
procedure TSQLPropInfoRTTIDouble_Precision2.GetValueVar(Instance: TObject; ToSQL: boolean;
var result: RawUTF8; wasSQLString: PBoolean);
var
D: Double;
begin
if wasSQLString<>nil then
wasSQLString^ := false;
Result := FormatFloat('0.00', PropInfo.GetExtendedValue(Instance));
end;
begin
RegisterSQLPropInfo(TypeInfo(TDouble_Precision2), TSQLPropInfoRTTIDouble_Precision2);
end.
Last edited by hnb (2016-07-06 06:17:23)
best regards,
Maciej Izak
Offline
Ping. Attached patch has no performance issue for existing code base... That feature has critical meaning for my projects.
Corrected patch: https://drive.google.com/file/d/0B4PZhd … sp=sharing
best regards,
Maciej Izak
Offline
Any feedback ? Can I commit my changes to fossil?
best regards,
Maciej Izak
Offline
I've updated the implementation, to use a class procedure TSQLPropInfoRTTI.RegisterTypeInfo() for ORM custom types.
Makes more sense to me than a global function.
See http://synopse.info/fossil/info/76b39f90090f5
Online
Looks much better -,-
best regards,
Maciej Izak
Offline
Pages: 1