Database field to Generic T conversion?
What is the cleanest and/or fastest way to convert a variant to a specific type T where T is limited to a simple type and comes from a database.
TMyClass = class
function Convert(const Field: TField):T;
How slow will using RTTI be?
function TMyClass.Convert(const const Field: TField):T;
v := TValue.FromVariant(Field.AsVariant);
Result := V.AsType;
Am I better off using explicit conversions and/or casts per TFieldType or per Variant type?
Just to explain why I want to do this: End goal is to have a non-visual “virtual query result grid” (i.e. rows by columns) where values are converted from database values to their “natural” Delphi types and then passed to other systems which will render the data with various decorators. Grid sizes can in theory vary from 10 rows by 20 columns to 5000 rows by 60 columns.
I want to let go of the Dataset as fast as possible, and keep the results in this virtual structure. The hope is to be able to cut down amount of query to grid scaffolding code, among other things.