ODBC TSqlQuery MySql float problem lazarus / 16-Databases ---------------------------------------------------------------------- xinyiman · 2010-01-13 12:56 Hello, I'm creating a software that interfaces Lazarus with MySQL using ODBC, and so far so good, insert, remove, modify and read! The problem occurred last night, which I incorrectly entered a number into a float in mysql, but when I run the query in a grid does not make me see the decimal part of number, why?! If I try to read the data with FieldByName (). Asfloat I still returns an integer. If I put 8.7 gives me 8 if I put my 6.5 returns 6. I tried both on Ubuntu than on Winzoz, strange case on winzoz works in Ubuntu and no! Why is this happening?! Sincerely ps: please correct your answer, for me it's urgent! Thanks ---------------------------------------------------------------------- LacaK · 2010-01-14 08:03 Please provide: 1. SQL structure of table on MySQL 2. version of MySQL 3. Check field type of "problematic field" (double click on TSQLQuery component, right-click "Add fields" ...) ---------------------------------------------------------------------- xinyiman · 2010-01-14 11:47 1. SQL structure of table on MySQL mysql> describe T_Tariffe; +-------------+-------------+------+-----+---------+----------------+ | Field       | Type        | Null | Key | Default | Extra          | +-------------+-------------+------+-----+---------+----------------+ | IdTariffa   | int(11)     | NO   | PRI | NULL    | auto_increment | | NomeTariffa | varchar(50) | NO   |     | NULL    |                | | Prezzo      | float(8,2)  | NO   |     | NULL    |                | +-------------+-------------+------+-----+---------+----------------+ 3 rows in set (0,02 sec) 2. version of MySQL: MySQL 5.1.37-1ubuntu5 3. Check field type of "problematic field" (double click on TSQLQuery component, right-click "Add fields" ...): return access violation error ---------------------------------------------------------------------- marcov · 2010-01-14 12:58 My guess would be that it is a locale problem. IOW is maybe "." not the decimal separator of your locale? ---------------------------------------------------------------------- xinyiman · 2010-01-14 13:03 I do not know where to look what is the decimal point, but I know that MySQL uses the point as decimal separator. it inserted but it does read returns this problem! ---------------------------------------------------------------------- LacaK · 2010-01-15 06:44 Can you insert record into table using some MySQL utility, so we are sure, that number with decimal part is inserted ? Then if you open this table, in TDBGrid still you see only integer part of number ? Is this only Ubuntu problem, on Windows it works as expected ? ---------------------------------------------------------------------- xinyiman · 2010-01-15 07:00 Have entered into MySql and the decimal part is present, but when the call given by Lazarus I can not see it. On window is perfect, no problem, the problem persists only on Ubuntu 64-bit, Italian language! But in my opinion is not a problem of TDBGrid as the TSqlQuery, because if I go to read the field code with FieldByName (). AsFloat me only returns the integer part of number. I tried to set also DecimalSeparator=',' and the ThousandSeparator='.' but the problem persists! Help me please ---------------------------------------------------------------------- LacaK · 2010-01-15 11:20 Hm, may be, that the problem is related: 1. to 64bit environment or/and 2. Ubuntu In this case I can not help you, because I am working only with 32bit Windows. If somebody else confirms , that problem really exists, may be it is bug in FPC ... then you should post bug report. ---------------------------------------------------------------------- xinyiman · 2010-01-15 12:47 Who takes care of putting the bug in the bug report? ---------------------------------------------------------------------- LacaK · 2010-01-15 13:43 You must post bug-report (if you are sure, that it is bug in Free Pascal). You can do it here http://bugs.freepascal.org/my_view_page.php (but fixing may take months, so do not expect fast solution) ---------------------------------------------------------------------- xinyiman · 2010-01-15 14:00 Ma non sono sicuro al 100% che sia un problema di lazarus. Però tutto fa pensare ciò! Non ho mai postato un bug, mi spieghi come fare, quale voce devo cliccare? ---------------------------------------------------------------------- xinyiman · 2010-01-18 08:08 Then I replaced the object TODBC with TMySQL50Connection and everything now works, then I think that the problem is the object TODBC in Ubuntu Desktop 64 bit!