Change UseNumbers dynamically

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
heidenbluth
Posts: 56
Joined: Mon 08 Nov 2004 19:01
Location: Germany

Change UseNumbers dynamically

Post by heidenbluth » Fri 15 Feb 2008 15:00

TOraSession.UseNumbers := True does not work properly if you use ODAC in conjunction with DevExpress Grids and define grid totals such as SUM below the grid. You will get an error like cannot convert OleStr to Double.

I need long numbers only for one query. The totals are needed for a bunch of other queries. Thats why I would like to have UseNumbers as a property of the dataset rather than of the session. My idea for a workaround was to change the session property temporarily to true while the appropriate query is beeing opened and the turn it back to false.

My questions are:
- Can this have any side effects?
- Would you consider to adding a new property UseNumbers to TOraDataset in a future version?
- An alternative would be that you could reconcile the TOraNumber data type with OleStr and make it working together with DevExpress grid totals computation.

Regards,
Holger

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

Post by Plash » Tue 19 Feb 2008 13:54

A value of TOraNumberField can be returned only as variant of string type because any Delphi numeric type does not have enough precision. So that the sum cannot be calculated for TOraNumberField.

You can set EnableNumbers option of TOraSession before opening a query. This should not have side effects. So that there is no need to add such property to dataset.

You can also try to use Int64 fields instead of Number fields, if your long numbers do not have a fractional part. These fields should work in the total calculations. To enable Int64 fields, set LargeIntPrecision variable from OraClasses unit in initialization part of one of your program units.

Code: Select all

initialization
  LargeIntPrecision := 38;
end;
But you cannot create TLargeintField fields at design-time with Fields Editor.

Post Reply