ERROR in retreiving small negativ double number!!!!!

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
TheLion
Posts: 39
Joined: Thu 25 Nov 2004 11:28
Location: Copenhagen/Denmark

ERROR in retreiving small negativ double number!!!!!

Post by TheLion » Sat 10 Jun 2006 09:51

Hi :-)

I use Delphi 5 Enterprise. MyDAC 4.30.1.15. MySQL 4.0.26 Commercial version.

If I store a TDateTime number -1/24. a negativ hour. That is not what I get back when I read it. The number in MySQL is correct but what MyDAC gives me is incorrect.

I have made a small exsample aswell:

Drop a TMyConnection, TMyQuery, TMemo and a TButton on a form.

Code: Select all

unit Main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Db, MemDS, DBAccess, MyAccess;

type
  TForm1 = class(TForm)
    MyConnection1: TMyConnection;
    MyQuery1: TMyQuery;
    Memo1: TMemo;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  MyQuery1.SQL.Text := 'DROP TABLE IF EXISTS errorindouble';
  MyQuery1.Execute;
  MyQuery1.SQL.Text := 'CREATE TABLE IF NOT EXISTS errorindouble (id INT NOT NULL, DTTime double NOT NULL)';
  MyQuery1.Execute;
  MyQuery1.SQL.Text := 'SELECT * FROM errorindouble';
  MyQuery1.Execute;
  MyQuery1.Insert;
  MyQuery1['id']     := 1;
  MyQuery1['DTTime'] := -1/24;
  Memo1.Lines.Append(FloatToStr(MyQuery1['DTTime']));
  MyQuery1.Post;
  MyQuery1.SQL.Text := 'SELECT * FROM errorindouble WHERE id=1';
  MyQuery1.Execute;
  Memo1.Lines.Append(FloatToStr(MyQuery1['DTTime']));
end;

end.
This error suddenly ruined a lot of date on two LIVE server systems. One in UK and one in DK. Not good :-(
I tested MyDAC 4.30.1.14 and the error was there aswell. I don't have build 13 nor 12, but 4.30.0.11 doen't have this error.

We wanna upgrade MySQL along the way from 4.0 to 4.1 and later 5.x. We DON'T need Errors like this. Should we downgrade to MyDAC 3.55.026 (whish also doesn't have this error) or what?
Which is a stabil, errorfree version of MyDAC for Delphi5 and MySQL 4.x?

Also the latest versions (including MyDAC 3.55.026) makes a lot of connections errors.

Code: Select all

Can't connect to MySQL server on 'localhost' (10061)
Socket error on connect. WSAGetLastError return 10048($2740)
We been using Delphi5 and MySQL 4.0.26 for a long time. The only varible seems to be MyDAC. In the new compiles I've put in

Code: Select all

MyConnection.Options.Protocol := mpTCP
So MyDAC doesn't use NT-Pipes one Localhost. We have close to no connection errors from LAN connected Servers. So I hope mpTCP is the way to go.

Other than the lastest Hickups, MyDAC is a great product. But we could use a MyDAC version "locked" to MySQL 4.0 and one for 4.1.
When I am using MySQl 4.0, the lastest version of MyDAC might not be right for me, but which version is?
Not every company is storming ahead and using MySQL 5.1.

Thank you for reading my post and I hope to get replies soon.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 14 Jun 2006 14:04

Unfortunately this bug was introduced into MyDAC 4.30.0.13. It concerns changing of conversion floating point values algorithm. The bug is already fixed. This fix will be included into the next MyDAC build. As a temporary solution you should use FieldsAsString option set to True.

Post Reply