Page 1 of 1
MySql, Float and ZeosDbo
Posted: 28.10.2005, 16:11
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
Posted: 28.10.2005, 18:54
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!! :-( ))!
Posted: 31.10.2005, 18:11
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.
Posted: 01.11.2005, 10:36
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!
Posted: 01.11.2005, 14:04
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)?
Posted: 02.11.2005, 13:35
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.