For both our SynOleDB and SynBigTable units, we allow
late-binding of data row values, using a variant and direct named
access of properties. Thanks to this unique feature (as far as I know in the
Delphi database world),
This allows clear and valid code as such:
var Customer: Variant;
begin
with Props.Execute(
'select * from Sales.Customer where AccountNumber like ?',
['AW000001%'],@Customer) do
while Step do
assert(Copy(Customer.AccountNumber,1,8)='AW000001');
end;
In practice, this code is slower than using a standard property based
access, like this:
while Step do
assert(Copy(Column['AccountNumber'],1,8)='AW000001');
But the first version, using late-binding of column name, just sounds more
natural.
Of course, since it's late-binding, we are not able to let the compiler
check at compile time for the column name. If the column name in the source
code is wrong, an error will be triggered at runtime only. But it would not be
an issue, since it would be the same for the SQL code inserted: it's only
executed at runtime (this is one of the benefits of using an ORM, by the way:
the ORM will generate correct SQL code for you...).
The default VCL implementation of this late-binding was a bit slow
for our purpose.
Since it has to deal with Ole Automation, and because it's fun, we
hacked the VCL to provide a lighter and faster version for our custom variant
types.