Since version 3.5.7 of libreoffice I get wrong double values in libreoffice-calc from the mySql database with libroffice-basic. It worked fine until 3.5.4. The query using mysql - commandline: [code] mysql> select eurprice from items where itemcode ="wbv"; +----------+ | eurprice | +----------+ | 8.6000 | +----------+ 1 row in set (0.00 sec) [/code] The same from libreoffice-calc with libreoffice-basic, _same database_ of course: [code] Dim price as double Dim selectString as string Dim Statement As Object Dim ResultSet As Object selectString = "select eurprice from items where itemcode = '"wbv'" Statement = gConnection.createStatement() ResultSet = Statement.executeQuery(selectString) .... ' some error handling here price = ResultSet.getDouble(1) [/code] For 'price' I get just '8' instead of '8.6' The code above had proven to work for some years now, but since my update to 3.5.7 (Ubuntu:1.3.5.7 to be precise) my reults are wrong. With 3.5.4 everything was still fine. After downgrade from 3.5.7 to to 3.5.4 everything is fine again.
I can not tell wether the version was 3.5.7.1. or 3.5.7.2, but it was one of these. I consier this bug critical as it simply yyields wrong results thus making e.g. any billing-software unusable. The bug silently produces wrong numbers. I detected id by accident.
sbatto, It would help us if you give us some more information: (1) Does you problem still happen with a recent version of LibreOffice? You can get one from <http://www.libreoffice.org/download/>. (2) What database engine are you connecting to? By what method? (3) Please give us the definition of table "items". Some sammple data would not hurt. (4) Please attach a .odb file with the macro. Remember that attachments are available to the whole world, so you may not want to create a new .odb which omits anything confidential. Thank you for helping us improve LibreOffice. Terry.
As I've left ubuntu and have a debian installation now, all versions have changed thus making it impossible to reproduce the exact situation. I could easily reproduce the error withe the above mentioned configuration and version, but now things have changed. I do not use a recent version and cannot install one under debian wheezy. However, here's what I still can do for you: 1. Table description: mysql> describe items; +--------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+-------+ | itemcode | varchar(10) | NO | PRI | NULL | | | description | varchar(256) | NO | | NULL | | | eurprice | decimal(9,4) | NO | | NULL | | | unit | varchar(10) | NO | | NULL | | | taxcode | int(11) | NO | | 1 | | | invoiceGroup | varchar(40) | NO | | NULL | | | maxunits | decimal(9,4) | NO | | 0.0000 | | +--------------+--------------+------+-----+---------+-------+ mysql> select * from items; +----------+------------------+----------+-------+---------+------------------+----------+ | itemcode | description | eurprice | unit | taxcode | invoiceGroup | maxunits | +----------+------------------+----------+-------+---------+------------------+----------+ | flt | flight ticket | 0.0000 | doc | 1 | travelling costs | 0.0000 | | who | Webhosting | 8.6000 | mon | 1 | | 0.0000 | | oed | other efforts | 0.0000 | doc | 1 | other efforts | 0.0000 | | wbv | webconsult | 8.6000 | mon | 1 | | 0.0000 | +----------+------------------+----------+-------+---------+------------------+----------+ 4 rows in set (0.00 sec) 2. Database is mysql as already described in my first post. 3. I am using openoffice basic to access the database (as already described in my first post. ...) 4. This is how I connect: gDatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext") gDataSource = gDatabaseContext.getByName("mydatabase") If Not gDataSource.IsPasswordRequired Then gConnection = gDataSource.GetConnection("","") Else gInteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler") ' msgbox gInteractionHandler.dbg_properties ' gConnection = gDataSource.ConnectWithCompletion(gInteractionHandler) End If The connection is configured in a 'mydatabase.odb' file. I think it's an odbc connection. 5. The oo-basic statements I used are, guess what, - already described in my first post. 5. Operating system is linux. 6. Frontend is oo-calc (libreoffice) Ok, my request is now 9 months old. I tried to live with that for some weeks, but than I downgraded as described above in my first post. Now, under debian, I am using LibreOffice 3.5.4.2, Build-ID: 350m1(Build:2), were everything is fine. Somehwat late to remember all the details. Hope I could help.
Created attachment 91471 [details] .odb with macro incorporating sbatto's code plus some corrections and additions The included macro `sbatto_01` shows price = 8.6. Comments identify code that I have added or changed.
I cannot point to just what has changed since sbatto reported this problem. So, am setting status WORKSFORME.