Problem with IntegerPrecision in the OraClasses.pas module

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
StanislawS
Posts: 6
Joined: Thu 19 Jul 2012 15:42

Problem with IntegerPrecision in the OraClasses.pas module

Post by StanislawS » Thu 19 Jul 2012 15:49

Hello!

Upon migrate from BDE to ODAC there was the following problem. Fields of tables which in ORACLE 10g are defined as NUMBER (10) in Delphi5 with BDE 5.2 are defined as TIntegerField, but with ODAC 7.00.0.3 - as TFloatField. According to FAQ, we changed the value for IntegerPrecision = 10 in the OraClasses.pas module. Didn't help. As before, ODAC maps Oracle NUMBER (10) to TFloatField. Reinstalled ODAC. Didn't help too. What it is a problem and what is possible to make in our case?

Thank You!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by AlexP » Fri 20 Jul 2012 09:03

hello,

The value of this variable should be set before connection, in this case, the fields with Precision less then the variable value will be determined as TIntegerField.
In There is a new functionality in the new ODAC version 8.2.7 - Data Type Mapping, that allows to set up mapping of all DB field types to any supported Delphi types in both design and run time.

StanislawS
Posts: 6
Joined: Thu 19 Jul 2012 15:42

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by StanislawS » Fri 20 Jul 2012 14:22

Thank you very much for the help and for a quickly reply.

So, the problem consists that the value of Precision should be LESS, instead LESS OR EQUAL, than the value of IntegerPrecision as it is specified in the FAQ. We have increased IntegerPrecision to 11. And now, really, ODAC maps Oracle NUMBER (10) to TIntegerField.

Thank you for the help once again.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by AlexP » Mon 23 Jul 2012 11:24

hello,

We have checked the behaviour of this global variable - everything works correctly like it is described in the help (LESS OR EQUAL). Please specify the exact version of your Oracle server, the server may return Precision fields incorrectly.

StanislawS
Posts: 6
Joined: Thu 19 Jul 2012 15:42

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by StanislawS » Mon 23 Jul 2012 14:18

Hallo,

We have Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

Best regards

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by AlexP » Tue 24 Jul 2012 09:44

hello,

We have checked the behaviour when setting this variable - and NUMBER fields with precision LESS OR EQUAL to the IntegerPrecision variable value are defined as TIntegerField.
Please execute the following query to make sure that the server returns the correct Precision value for your field:

SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION
FROM ALL_TAB_COLUMNS
WHERE TABLE_NAME = 'TABLE_NAME'
AND OWNER = 'SCHEMA_NAME'
AND COLUMN_NAME = 'COLUM_NNAME'

StanislawS
Posts: 6
Joined: Thu 19 Jul 2012 15:42

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by StanislawS » Tue 24 Jul 2012 12:27

Hello,

We have executed the query on several tables and any discrepancies didn't find. The server always returns the correct Precision value.

Thank you.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by AlexP » Tue 24 Jul 2012 13:07

Hello,

Please try to create a new text table

Code: Select all

CREATE TABLE T_TEST
(
F_ID NUMBER(10)
);
and check the behaviour of IntegerPrecision variable on it, and inform us of the results.

StanislawS
Posts: 6
Joined: Thu 19 Jul 2012 15:42

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by StanislawS » Wed 25 Jul 2012 10:09

Hello,

For problem research we have created a small test table.

Code: Select all

CREATE TABLE T_TEST
(
F_ID09 NUMBER(9),
F_ID10 NUMBER(10),
F_ID11 NUMBER(11)
);
As a result of research it was determined that if fields are dynamically created by OraQuery then ODAC maps Oracle NUMBER (10) in full accordance with the criteria specified in documentation. But in Design Modus ODAC maps the NUMBER fields incorrectly. As it was specified earlier, comparing occurs by criterion LESS, instead of LESS OR EQUAL. And NUMBER (10) becomes TFloatField, instead TIntegerField.

Code: Select all

type
  TForm1 = class(TForm)
    OraQuery1: TOraQuery;
    DBGrid1: TDBGrid;
    OraSession1: TOraSession;
    OraDataSource1: TOraDataSource;
    BitBtn1: TBitBtn;
    OraQuery1F_ID09: TIntegerField;
>>>  OraQuery1F_ID10: TFloatField;  <<<
    OraQuery1F_ID11: TFloatField;

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by AlexP » Wed 25 Jul 2012 10:58

hello,

Setting local variable values will produce an effect only at run-time, and since persistent fields are created at design-time, then the value of this variable is 9 (the default value). Therefore your fields are created correctly. To change this behaviour, you should either edit our sources (if you have a source code version), or use Data Type Mapping to change field type in design-time.

StanislawS
Posts: 6
Joined: Thu 19 Jul 2012 15:42

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by StanislawS » Wed 25 Jul 2012 14:40

Hello,

OK, it is clear.

Thank you for the help.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Problem with IntegerPrecision in the OraClasses.pas module

Post by AlexP » Thu 26 Jul 2012 13:11

hello,

If you have any other questions, feel free to contact us.

Post Reply