From: Ben C. <bcl...@pe...> - 2004-12-20 16:45:31
|
Massimiliano, You have a very interesting problem. One which I have never seen before. Some call from you program is formatting 0.16 as 0,16. Can you tell me what system you are running. Also what compiler you are using. Can you try these for me: 1. In libpp_mysql/dbms.c can you uncomment the line: #define SHOW_SQL 2. Can you then make all you code again and try: perfparse-db-tool --update 3. Do you see this line: Can you return what you see? SQL: "UPDATE perfdata_registry SET rvalue = '0.16', ctime = FROM_UNIXTIME(1103561358) WHERE host = 'dummy' AND rkey = 'pp/database/version'" 4. Please remove the SHOW_SQL and recompile. 5. Can you launch MySQL and try: mysql> create table test ( value double ) type=innodb; mysql> insert test values (0.15); mysql> select * from test; Do you get 0.15 or 0,15? If you could try these, this would be extremely useful to us! Kind regards, Ben. Massimiliano Minniti wrote: > Hi All, > >> This is an interesting one, and I don't know how it happened. >> >> You version in your database is '0,15'. It should be '0.15'. >> Internally this is converted to a double: >> >> double version = atof(version) >> >> So '0.15' -> 0.15 but '0,15' -> 0.00 >> >> Can please enter: >> >> mysql> UPDATE perfdata_registry SET rvalue = '0.15' WHERE rkey = >> 'pp/database/version'; >> >> Would you have any idea how this got like this to begin with? Any >> information you have would be very useful. >> >> The code which sets this is: >> >> void setVersion(double version) >> { >> char s[10]; >> sprintf(s, "%.2lf", version); >> >> >> Can you write a test program on your local UNIX box and let me know >> what this does on your system? >> >> int main() { double d = 0.15; printf("%.2lf", d); return 1 } >> > I have tested this source on my system and the output correctly is 0.15. > I updated my perfparse installation to version 0.104.4. > Because my old database schema is 0.15 my browse visualized the current > error message: > > "Current Version: 0.00, Required Version: 0.16. > Consider upgrading with: > perfparse-db-tool --update" > > Then I run perfparse-db-tool --update that after it visualized the > following correct message: > "Warning, this stage may take some time: > Auto-convert database up to version 0.16... > Conversions complete." > > But on my db the old correct values 0.15 now it is a wrong value 0,16 > and I fix this problem editing the correct value 0.16 on the db record. > IMHO the upgrading throught perfpars-db-tool have some some error. > > I hope that my description is clearly. > > Excuse me for my poor english! ;) > >> I note this is using the 'lf' GNU extension. Which GNU takes to mean >> 'long float'. Could your system take this to mean 'local float'? If >> you change this to "%.2f" does this fix the problem? >> >> Regards, >> >> Ben > > > Regards, > Massimiliano Minniti > -- Ben Clewett bcl...@pe... PerfParse http://www.perfparse.org PP FAQ http://wiki.perfparse.org/tiki-list_faqs.php |