[fpc-pascal] Re: Variant vs Pointer

Marco van de Voort marcov at stack.nl
Sat Mar 3 21:18:18 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)

> > 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?

> If higher precision numerics,a
> date/time formats, decimal points and other locale related conversions
> aren't an issue for you, and if you don't want strict compile time type
> checking, please do use variants.

Btw, there is a third route if you don't like stringly typing. In a past job
I had a "import" app that imported the schemas from the db, transformed them
(with additional lists of "exceptions") and generated pascal source code for
all the associated objects and collections and the queries to load/store
them.

For really big jobs with a lot of exceptions (e.g. homegrown database
layouts that are determined externally) this can be a great solution.



More information about the fpc-pascal mailing list