MySql, Float and ZeosDbo

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
amos
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 11.10.2005, 19:52

MySql, Float and ZeosDbo

Post by amos »

I have a problem with above combination...
Delphi 7, ZeosDbo (6.1.5 & 6.5.1) and MySql 4.1.
The problem is that if I put a whole number in float field, i can change it, but if i put a float number (eg. 6,35) the problem is that i can't change the value any more!!! And when in a field is whole number and i put a float number, it is changed but after that i cannot change the number!!

If i use any third party problem (Mentat MySql Turbo mamanger for eg.), i don't have that problem.

Where is the problem!?!?

Thx

P.S.
Sorry for multi posting :-(
--
That's all from Amos Sam
amos
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 11.10.2005, 19:52

Post by amos »

OK, i tried with BDE and it works!!!
Who is crazy here?!??

Plz help, because i can't switch to bde (and i like zeos (at least till now!! :-( ))!
That's all from Amos Sam

good, better, linux!

Is someone selling a apartment on Pluton? ;-)
therealkev
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 31.10.2005, 17:28

Post by therealkev »

Could you be more precise?

With "whole number" you mean integer?

Any ReadOnly-property (TZQuery/TZTable or TZConnection) set true?

Do you use TZQuery or TZTable?

Any SQL-statement in the TZQuery?

To be complete: please post the sql-statement to create the table with the problematic field.
amos
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 11.10.2005, 19:52

Post by amos »

therealkev wrote:Could you be more precise?

With "whole number" you mean integer?

Any ReadOnly-property (TZQuery/TZTable or TZConnection) set true?

Do you use TZQuery or TZTable?

Any SQL-statement in the TZQuery?

To be complete: please post the sql-statement to create the table with the problematic field.
"whole number" = integer.

No, the problem is not in any read-only property, because i can change field with integer number!

I use TZQuery with folowing sql statement for selecting records:

Code: Select all

SELECT * FROM RacunGL, Artikli WHERE (RacunGl.IdRacunGL = :ID) AND Artikli.IdArtikli IN (RacunGl.IdAtrikla)
And this is working.

SQL statement for table RacunGl:

Code: Select all

CREATE TABLE `racungl` (
  `idRacunGl` int(10) unsigned NOT NULL default '0',
  `idAtrikla` int(10) unsigned default NULL,
  `Kolicina` float unsigned default NULL,
  `Cijena` float default NULL,
  `Ukupno` float NOT NULL default '0',
  KEY `RacunGl_idRacuna` (`idRacunGl`)
) ENGINE=MyISAM DEFAULT CHARSET=latin2;
The problem is in field 'Kolicina'. I'm changing the value with folowing statement:

Code: Select all

 TZQuery1Kolicina.AsFloat := StrToFloat(Edit1.Text);
Table Artikli is only for naming fields.

I have found a way around. I use direct mysql client, and i have to change ',' to '.' in float numbers. In my regional setting decimal sign is ',' and MySql accepts only decimal sign '.'. This is working, but i don't like this solution!!

And i applyed both patches to ZeosDbo 6.1.5!
That's all from Amos Sam

good, better, linux!

Is someone selling a apartment on Pluton? ;-)
therealkev
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 31.10.2005, 17:28

Post by therealkev »

OK, I'm not that sure, but I think in a query like yours
SELECT * FROM RacunGL, Artikli WHERE (RacunGl.IdRacunGL = :ID) AND Artikli.IdArtikli IN (RacunGl.IdAtrikla)
changing a field should not work anyway - not with floats and not with integers. If it works with integers, this should be the bug.

There's a component called ZUpdateSQL for updating fields in joined tables like your query represents.
By the way: is there any reason (maybe performance), why you don't use a join or "Artikli.IdArtikli=RacunGI.IdArtikla" in your query (I'm just curious)?
amos
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 11.10.2005, 19:52

Post by amos »

therealkev wrote:OK, I'm not that sure, but I think in a query like yours
SELECT * FROM RacunGL, Artikli WHERE (RacunGl.IdRacunGL = :ID) AND Artikli.IdArtikli IN (RacunGl.IdAtrikla)
changing a field should not work anyway - not with floats and not with integers. If it works with integers, this should be the bug.
My mistake. I use ZTable witch i filter by two id's from selected record from ZQuery.
So the code is:

Code: Select all

DataModule1.ZTable1.Filtered := False;
DataModule1.ZTable1.Filter := 'idRacunGl = ' + ZQuery1idRacunGl.AsString + ' AND idAtrikla = ' + ZQuery1idArtikli.AsString;
DataModule1.ZTable1.Filtered := True;

DataModule1.ZTable1.Edit;
// DataModule1.ZTable1Kolicina get's its value from DBEdit control
DataModule1.ZTable1Ukupno.AsFloat := StrToFloat(DBEdit1.Text) * DataModule1.ZTable1Cijena.AsFloat;
DataModule1.ZTable1.Post;
By the way: is there any reason (maybe performance), why you don't use a join or "Artikli.IdArtikli=RacunGI.IdArtikla" in your query (I'm just curious)?
Whell, no particular reason! I didn't try the way you suggested, because in the way i wrote, it works fine with about 30k records in 'RacunGl' and about 200 records in Artikli.
That's all from Amos Sam

good, better, linux!

Is someone selling a apartment on Pluton? ;-)
Post Reply