4

I have a huge problem with TADOQuery:

This is my SQL:

select cast(-10 as number(9)) foo, -10 bar 
  from dual

Instead of TBCDField, a TIntegerField will be created when you add the "foo" field, because the type is changed at this point:

procedure TCustomADODataSet.InternalInitFieldDefs;

    if (F.Type_ = adNumeric) and (F.NumericScale = 0) and
       (F.Precision < 10) then
      FieldType := ftInteger;

the function:

function TCustomADODataSet.GetFieldData(Field: TField; Buffer: Pointer;
  NativeFormat: Boolean): Boolean;

Is not considering the signal at this point:

    ftAutoInc, ftInteger:
      Integer(Buffer^) := lVal;

the value of tagVariant for TIntegerField is:

(14, 32768, 0, 0, 10, 10, 10, 1.4012984643e-44, 4.9406564584e-323, True, 10, 0.001, 4.9406564584e-323, , $A, $A, $A, $A, $A, $A, $A, $A, $A, $A, $A, $A, $A '', $A, $A, $A, $A, $A, #10, 10, 10, 10, 10, $A, , $A, $A, $A, $A)

which is the same for TBCDField:

(14, 32768, 0, 0, 10, 10, 10, 1.4012984643e-44, 4.9406564584e-323, True, 10, 0.001, 4.9406564584e-323, , $A, $A, $A, $A, $A, $A, $A, $A, $A, $A, $A, $A, $A '', $A, $A, $A, $A, $A, #10, 10, 10, 10, 10, $A, , $A, $A, $A, $A)

The foo value will be 10 and the bar value will be -10.

Is this a bug?
There is a WorkAround?
It was fixed?

I'd tested using Microsoft OLEDB provider for Oracle and Oracle Provider for OLEDB. All tests have been done using Delphi 6.

EProgrammerNotFound
  • 2,403
  • 4
  • 28
  • 59

1 Answers1

0

I don't know if i have understood correctly, however try in this way:

select cast(replace(-10,'-','') as number(9)) foo, -10 bar 
  from dual;
Oibaf it
  • 1,842
  • 16
  • 9