[fpc-pascal] Re: Variant vs Pointer

Ludo Brands ludo.brands at free.fr
Sun Mar 4 09:54:27 CET 2012


> In our previous episode, Ludo Brands said:
> > When you are thinking of using JSON you can use AnsiString as the 
> > internal format eventually adding a datatype tag to avoid 
> conversion 
> > data loss as much as possible.
> 
> ansistring is a decimal type. This incurs a binary to decimal 
> conversion per se (which is afaik not needed in SQL if you 
> use parameters)
> 

In oracle the number data type is closer to decimal than binary. Binary
integer is converted to number for storage and binary float binary double
are fairly recent data types (>=10g). So it is dependant on the database
back-end.

There are many other oracle data types, far less used, that have to be
represented in their string representation such as timestamp (up to 9 digits
fractional second precision), timestamp with timezone and the interval data
types. 


> > > The TParams class, AFAIK, should work well with DBMS data
> > > format, don't?
> > > 
> > 
> > Again, the higher precision numeric and decimal datatypes 
> as used in 
> > fe. Oracle are poorly supported with variants
> 
> Variants or the current sqldb implementation?
> 

Variants in general. The current sqldb implementation does a good effort
with the VarFmtBCD custom variant type although its use requires a carefully
check of every variant assignment and operation to be sure there are no
hidden type conversions involved. The compiler will not do it for you. 


Ludo




More information about the fpc-pascal mailing list