Page 1 of 1

FLOAT field problem

Posted: Wed 21 Oct 2009 15:19
by Hanne Berthelsen
Is there a bug in the MyDAC package concerning queries on FLOAT fields?

I have the following MySQL table:

CREATE TABLE `postal` (
`Lat` float default NULL,
`Lon` float default NULL,
`PostalCode` char(8) default NULL,
`PostCodeNoSpace` char(8) default NULL,
`Description` char(40) default NULL,
UNIQUE KEY `PostalCodeIndex` (`PostalCode`),
KEY `Lat` (`Lat`,`Lon`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

I would like to use the following code for updating Description field in table postal:

MyQueryCopy->Close();
MyQueryCopy->SQL->Clear();
MyQueryCopy->SQL->Add("SELECT * FROM postal WHERE PostalCode='AB10 1AA'");
MyQueryCopy->Open();

MyQueryCopy->First();
if (MyQueryCopy->Eof == false)
{
MyQueryCopy->Edit();
MyQueryCopy->FieldByName("Description")->AsString = "Test";
MyQueryCopy->Post();
}
MyQueryCopy->Close();


BUT decription field is not updated.

If I instead use the following code:

MyQueryCopy->Close();
MyQueryCopy->SQL->Clear();
MyQueryCopy->SQL->Add("UPDATE postal SET Description='test' WHERE PostalCode='AB10 1AA'");
MyQueryCopy->Execute();
MyQueryCopy->Close();

Then the Description field is updated.

If I change the field types for Lon/Lat fields to DOUBLE or DECIMAL(25,12) then the the first query also works.

I am using MyDAC v. 5.80.0.46 / Borland C++ Builder 5
Would it help to upgrade to latest version of MyDAC?
Or could it be a MySQL problem? I am using MySQL v. 5.00.22

Posted: Mon 26 Oct 2009 10:51
by Dimon
I can not reproduce the problem.
Please, try to download the latest MyDAC build (5.90.0.52) and check if this problem still exists.
If it doesn't solve the problem, try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.