Page 1 of 1
WHY driver convert FLOAT POINT to FIX POINT?
Posted: Tue 05 Apr 2011 10:41
by a.n.ermakov
I am using dbexpoda.dll 4.80( last version), Delphi 7, Oracle11g.
ORACLE fields with data type BINARY_DOUBLE (it is floating point type but not fixed point type) in DELPHI have class TFMTBCDField.
I think it is MISTAKE. Must be class TFLOATField! Else I miss the precission in calculation.
Thanks in advance.
Posted: Tue 05 Apr 2011 13:02
by AlexP
hello,
To resolve the problem, you should set the EnableBCD option to false like:
Code: Select all
procedure TForm1.SQLQuery1BeforeOpen(DataSet: TDataSet);
const
coEnableBCD = TSQLConnectionOption(102);
begin
SQLConnection1.SQLConnection.SetOption(coEnableBCD, Integer(False));
end;
Posted: Wed 06 Apr 2011 09:52
by a.n.ermakov
[quote="AlexP"]hello,
To resolve the problem, you should set the EnableBCD option to false like:
It is no decision of problem. Realy I need fixed and float point numbers in the same application.
Posted: Wed 06 Apr 2011 11:35
by AlexP
Hello,
You can have the fixed and float point numbers in the same application, but you can't have them in the same dataset.
To have this effect, you can set the EnableBCD option each time before opening DataSet, like:
Code: Select all
procedure TForm1.SQLQuery1BeforeOpen(DataSet: TDataSet);
const
coEnableBCD = TSQLConnectionOption(102);
begin
SQLConnection1.SQLConnection.SetOption(coEnableBCD, Integer(False)); //ftFloat
end;
procedure TForm1.SQLQuery2BeforeOpen(DataSet: TDataSet);
const
coEnableBCD = TSQLConnectionOption(102);
begin
SQLConnection1.SQLConnection.SetOption(coEnableBCD, Integer(True)); //ftFMTBcd
end;
Posted: Thu 07 Apr 2011 10:12
by a.n.ermakov
I need to have the fixed and float point numbers in the same dataset.
Delphi read float pointing values in FMTBCD type with precision 32 and scale 8, and it cannot be changed.
We need 14 digits after point in some cases.
In MSSQL driver you solve this problem and use float type fields for float numbers and FMTBCD for fixed point numbers.
If we use driver option EnableBCD = false then we loose numbers more then 15 sign digits, and will have round errors.
Posted: Thu 07 Apr 2011 10:21
by a.n.ermakov
Code: Select all
unit Unit1;
interface
uses
Windows, FMTBcd, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, DB, DBClient, SimpleDS, Mask, DBCtrls,
DBXpress, SqlExpr;
type
TForm1 = class(TForm)
SimpleDataSet1: TSimpleDataSet;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
Button2: TButton;
DBEdit1: TDBEdit;
SQLQuery1: TSQLQuery;
SQLConnection1: TSQLConnection;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
SQLQuery1.Active:=false;
SQLQuery1.Params[0].AsFMTBCD:=Strtobcd(Edit1.Text);
SQLQuery1.ExecSQL;
end;
procedure TForm1.Button2Click(Sender: TObject);
var vtest:string;
begin
SimpleDataSet1.Active:=false;
SimpleDataSet1.Active:=true;
vtest:=BcdToStr(SimpleDataSet1.FieldByName('A').AsBCD);
ShowMessage(vtest);
end;
end.
Field type 'A' in Oracle BINARY_DOUBLE
Edit1.Text:=0.123456789012
Try this test.
Posted: Mon 11 Apr 2011 08:58
by AlexP
Hello,
We have fixed the problem.
This fix will be included in the next build.
To make sure that everything works correctly, we can send you the new trial version for testing before it will be released.
Please specify your e-mail address, so that I could send you the fixed trial version.