For several units of our framework, we allow late-binding of data
values, using a variant
and direct named access to
properties:
- In SynCommons, we defined our TDocVariant
custom
variant type, able to store any JSON/BSON document-based content;
- In SynBigTable, we use the TSynTableVariantType
custom
variant type, as defined in SynCommons;
- In SynDB, we defined a TSQLDBRowVariantType
, ready to
access any column of a RDBMS data result set row;
- In mORMot, we allow access to TSQLTableRowVariantType
column values.
It's a very convenient way of accessing result rows values. Code is still very readable, and safe at the same time.
For instance, we can write:
var V: variant; ... TDocVariant.New(V); // or slightly slower V := TDocVariant.New; V.name := 'John'; V.year := 1972; // now V contains {"name":"john","year":1982}
This is just another implementation of KISS design in our framework.
Since Delphi XE2, some modifications were introduced to the official
DispInvoke()
RTL implementation:
- A new
varUStrArg
kind of parameter has been defined, which will allow to transmitUnicodeString
property values; - All text property values would be transmitted as BSTR
/ WideString / varOleStr
variants to the invoked variant type; - All textual property names were normalized to be in UPPERCASE.
Those modifications are worth considering...
And we may have discovered two regressions: one about speed, and the other
about an unexpected logic bug...