Persistent field mapping during design time

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
skiller
Posts: 4
Joined: Thu 19 Feb 2009 09:56

Persistent field mapping during design time

Post by skiller » Thu 19 Feb 2009 10:32

Hi,

I want to migrate a BDE project to ODAC using the migration wizard. The wizard leaves all persistent fields as the were before (TIntegerField, TSmallintField, TFloatField, ...).

So, I have to set the following constants, in order to get no runtime errors during opening the datasets (I set them by overwriting the datamodules constructor):

Code: Select all

  SmallintPrecision := 5;               // until NUMBER(5,0) ==> TSmallIntField
  IntegerPrecision := 10;               // until NUMBER(10,0) ==> TIntegerField
  LargeIntPrecision := 20;              // until NUMBER(20,0) ==> TLargeIntField
And the Session Options:

Code: Select all

     Session.EnableIntegers = true
     Session.EnableLargeint = true
     Session.EnableNumbers = false
Untils this point all works as expected.

But during design time, the constants have their default values, so if I add persistent fields to the dataset using the fields editor, they have the wrong datatypes. For example:

Code: Select all

Number(5,0)
==> TIntegerField (I want TSmallintField, 16 bit)

Code: Select all

Number(10,0)
==> TLargeIntField (I want TIntegerField, 32 bit)

Code: Select all

Number(20,0)
==> TFloatField (I want TLargeIntField, 64 bit)

I dont want to add all fields manually, so how do I set the OraClasses constants in order to have during design time the same behaviour as during run time?

Regards
skiller

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 24 Feb 2009 08:57

You can create your own design time package that uses the odac package with the following code:

Code: Select all

unit MyUnit;

interface

implementation

uses
  OraClasses;

initialization
  SmallintPrecision := 5;
  IntegerPrecision := 10;
  LargeIntPrecision := 20;
end.

skiller
Posts: 4
Joined: Thu 19 Feb 2009 09:56

Post by skiller » Tue 24 Feb 2009 09:45

This forces all ODAC database connections using the same values. I think it would be better to define these constants session dependent (as published properties).

But this time it's OK for me.

thx

Post Reply