Finer data type mapping

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
Guest

Finer data type mapping

Post by Guest » Mon 29 May 2006 09:20

Hello,
I am in need of doing some finer data type mapping than what is available today through the *Precision settings. In particular, I need to treat NUMBER(1,0) as boolean and NUMBER(15,4) as currency. In order to do that I can see several paths, but all of them involve modifying the dbX driver. I have tried doing it in my middleware code but it gets very messy.
Here are the simplest proposals I could come up with:

a) the driver sets TFieldDef.Precision and TFieldDef.Size even for float and integer fields (that is, when EnableBCD is set to False). In this case the properties would have only an informative meaning; this would allow an application to react accordingly and change the FieldDefs properties simply by overriding InitFieldDefs. In case this behaviour is considered potentially harmful, it could be guarded by a parameter and even be off by default.

As an alternative:

b) the driver supports booleans and currency on its own, by means of new parameters BooleanPrecision and CurrencyPrecision/CurrencySize.

In case option b looks too messy, because of proliferation of parameters, perhaps a cleaner way may be devised:

c) a single new parameter DataTypeMaps of type string is added, which will optionally contain mapping specifications in a simple syntax that the driver will parse after all other mappings are done. This would allow one to support booleans and currency by writing, for example:

{MinPrecision=0;MaxPrecision=1;MinSize=0;MaxSize=0;DataType=ftBoolean}{MinPrecision=15;MaxPrecision=15;MinSize=4;MaxSize=4;DataType=ftCurrency}

I hope one of these proposals, or equivalent functionality that will allow me and others to tune the mappings in a finer way can be implemented in the driver.

Thanks
--
Nando Dessena

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Wed 31 May 2006 11:32

Thank you for assistance. We will consider your suggestion and perhaps implement it in future versions.

pepito_juanito
Posts: 4
Joined: Thu 10 Nov 2005 13:49

Post by pepito_juanito » Wed 31 May 2006 12:05

Did you take a look to dbexpressplus components?

I´m not very sure but I think i look something like that in TSQLConnectionPlus.options.

Nevertheless if it do not fill your needs, you have the source!

It works very well with corelabs dbexpress drivers (I think Thomas Miller, the author, uses them).

Kisses for the kids.

nandod
Posts: 15
Joined: Mon 29 May 2006 09:03

Post by nandod » Fri 02 Jun 2006 11:26

challenger wrote:Thank you for assistance. We will consider your suggestion and perhaps implement it in future versions.
Thanks. Unfortunately I need to do something about it "here and now", so to speak, for a customer's project. I guess I'll have to patch the sources myself. :(

nandod
Posts: 15
Joined: Mon 29 May 2006 09:03

Post by nandod » Fri 02 Jun 2006 11:29

pepito_juanito wrote:Did you take a look to dbexpressplus components?
Yes. Doesn't suit my needs. What I have in my hands is a framework for seamlessly porting BDE applications to dbX, that's why I need options to fine tune data type mappings; Old dfms with persistent fields of any type should be compatible.

Thanks

Post Reply