You are not logged in.
Hi,
To improve the compatibility with original mORMot, it would be great to implement generics.
For example :
function RetrieveList(Table: TSQLRecordClass; const FieldNames,
SQLWhere: string; const BoundsSQLWhere: array of const): TObjectList;
For this :
{$IFDEF NEXTGEN}
function RetrieveList(Table: TSQLRecordClass; const FieldNames,
SQLWhere: string; const BoundsSQLWhere: array of const): TObjectList<T>;
{$ELSE}
function RetrieveList(Table: TSQLRecordClass; const FieldNames,
SQLWhere: string; const BoundsSQLWhere: array of const): TObjectList;
{$ENDIF}
Offline
I would rather add something like in the main mORMot.pas unit.
That is, properly using generics for the overloaded version - something like:
{$ifdef ISDELPHI2010} // Delphi 2009 generics support is buggy :(
function RetrieveList<T: TSQLRecord>(const FieldNames, SQLWhere: string; const BoundsSQLWhere: array of const): TObjectList<T>; overload;
{$ifdef HASINLINE}inline;{$endif}
{$endif}
Your version would be confusing for the compiler.
Offline
I would rather add something like in the main mORMot.pas unit.
That is, properly using generics for the overloaded version - something like:
{$ifdef ISDELPHI2010} // Delphi 2009 generics support is buggy :( function RetrieveList<T: TSQLRecord>(const FieldNames, SQLWhere: string; const BoundsSQLWhere: array of const): TObjectList<T>; overload; {$ifdef HASINLINE}inline;{$endif} {$endif}
Your version would be confusing for the compiler.
Yes it's much better than mine.
Offline
I've added TSQLRest.RetrieveList<T> to the cross-platform clients.
See https://synopse.info/fossil/info/1bbe25b1c6
Offline
I've added TSQLRest.RetrieveList<T> to the cross-platform clients.
See https://synopse.info/fossil/info/1bbe25b1c6
Great! Thank you very much!
Offline
Feedback is welcome: I didn't test it on NextGen/iOS/Android platforms.
I'm currently developing/testing it for a Firemonkey Android client. I will back with updates.
Offline