Subject Re: [IBO] Fieldtypes
Author Geoff Worboys
> Can all fields in a db(specifically ib) be converted to
> the following varianttypes.

Sort of :-)

Mostly it is done automatically for you when retrieving values AsValue
or AsVariant.

The type list you provided are not actually variant types (they are
used in TVarRec). See VarType for the actual list of variant types.
The VCL sometimes forces variants to support various other data types
(such as int64) but these are not supported outside the VCL. As such
they are likely to cause you problems. The reason for the problems is
that many VCL functions hand-off variant processing to MS DLLs and
those DLLs will get upset when given variant types they dont
understand.

For example...

vtInt64 will cause AVs in various packages because it is not supported
outside the VCL.

varInteger (etc) and varDate will be translated to/from string using
MS DLL, meaning that the Delphi globals (ShortDateFormat etc) will be
ignored and this can lead to inconsistent results. If you are using
IBO3 see the CustomSpinEdit.pas unit, VariantToStr function for an
example of how to work around this problem.


> My question is actually how does the tfield type manage
> different types of fields and how does the class make sure
> of compatibility when you convert a field to a variant.
> How will tfield know when a field is TIBOFloatField and
> not just a TFloatField?

TIBOFloatField is declared as

TIBOFloatField = class( TFloatField )

So anything you do to TFloatField you can do TIBOFloatField and the
derivation takes care of specifics. Its called object oriented
programming ;-)


Geoff Worboys
Telesis Computing