Hi there,
Not sure if this is a CocoaMysql issue, or just my lack of understanding, but I have a weird problem!
I have a database with a few fields including one "Decimal" field (Price). The length of this field is 4,2.
When I create a record, I can enter "E6 220" for the name, and "2.40" for the price, and this works fine.
When I go back to the same record and edit any other field (like making the name "E7 220" the price suddenly changes to 99.99.
This is the syntax of the update if I manually adjust the price on it's own:
UPDATE `products` SET `id`='E6220', `name`='E6 220', `catagory`='FP2', `customerid`='', `price`='1.60', `Surface`='' WHERE `id` LIKE 'E6220';
and this is the syntax of the update if I edit the name (from E6 220 to E7 220)
UPDATE `products` SET `id`='E6220', `name`='E7 220', `catagory`='FP2', `customerid`='', `price`='312E3630', `Surface`='' WHERE `id` LIKE 'E6220';
Note how the price has changed to 312E3630.
Is anyone able to shed some light on what's happening?
Cheers!
Ant.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a bug in the current beta which is fixed in the source code. You find a current build on http://cocoamysql.sourceforge.net/beta/CocoaMySQL-pre0.7b6.zip (please note that the import/export in this build is beta and only import/export of SQL files is working currently).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
got similar thing.
it looks like a buggy representation of certain decimal numbers in CocoaMysql 0.5 (v0.5).
I did the following:
mysql>
CREATE TABLE `test` (
`id` int(8) NOT NULL auto_increment,
`test` decimal(9,2) NOT NULL default '0.00',
PRIMARY KEY (`id`)
) TYPE=InnoDB;
INSERT INTO `test` (`id`,`test`) VALUES ("1","95.82");
INSERT INTO `test` (`id`,`test`) VALUES ("2","96.26");
INSERT INTO `test` (`id`,`test`) VALUES ("3","2.40");
CocoaMysql shows
id test
1 95,81999999999999
2 96,26000000000001
3 2.40
mysql shows
mysql> SELECT * FROM test.test;
+----+-------+
| id | test |
+----+-------+
| 1 | 95.82 |
| 2 | 96.26 |
| 3 | 2.40 |
+----+-------+
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
still there is something tricky with a database application (mysql) and the connection to a client application.
a similar thing occurred today filling a database with LAMP.
after some 150 inserts the sum calculation at the end of the page gave the same number of decimals.
,26000000000001
if i have time i'll search the php.net site.
but this is nun of your concern. thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think that might have something to do with precision of decimals. Probably these decimals are the same in respect to the precision of these data types. Maybe you have to use another decimal type... (Unfortunately I don't know much about that issue, sorry.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
Not sure if this is a CocoaMysql issue, or just my lack of understanding, but I have a weird problem!
I have a database with a few fields including one "Decimal" field (Price). The length of this field is 4,2.
When I create a record, I can enter "E6 220" for the name, and "2.40" for the price, and this works fine.
When I go back to the same record and edit any other field (like making the name "E7 220" the price suddenly changes to 99.99.
This is the syntax of the update if I manually adjust the price on it's own:
UPDATE `products` SET `id`='E6220', `name`='E6 220', `catagory`='FP2', `customerid`='', `price`='1.60', `Surface`='' WHERE `id` LIKE 'E6220';
and this is the syntax of the update if I edit the name (from E6 220 to E7 220)
UPDATE `products` SET `id`='E6220', `name`='E7 220', `catagory`='FP2', `customerid`='', `price`='312E3630', `Surface`='' WHERE `id` LIKE 'E6220';
Note how the price has changed to 312E3630.
Is anyone able to shed some light on what's happening?
Cheers!
Ant.
This is a bug in the current beta which is fixed in the source code. You find a current build on http://cocoamysql.sourceforge.net/beta/CocoaMySQL-pre0.7b6.zip (please note that the import/export in this build is beta and only import/export of SQL files is working currently).
Thanks for the info! I'll check out the new build.
Cheers,
Ant.
got similar thing.
it looks like a buggy representation of certain decimal numbers in CocoaMysql 0.5 (v0.5).
I did the following:
mysql>
CREATE TABLE `test` (
`id` int(8) NOT NULL auto_increment,
`test` decimal(9,2) NOT NULL default '0.00',
PRIMARY KEY (`id`)
) TYPE=InnoDB;
INSERT INTO `test` (`id`,`test`) VALUES ("1","95.82");
INSERT INTO `test` (`id`,`test`) VALUES ("2","96.26");
INSERT INTO `test` (`id`,`test`) VALUES ("3","2.40");
CocoaMysql shows
id test
1 95,81999999999999
2 96,26000000000001
3 2.40
mysql shows
mysql> SELECT * FROM test.test;
+----+-------+
| id | test |
+----+-------+
| 1 | 95.82 |
| 2 | 96.26 |
| 3 | 2.40 |
+----+-------+
That is another bug and it is fixed in the current beta. Thanks.
thanks for the quick reaction.
still there is something tricky with a database application (mysql) and the connection to a client application.
a similar thing occurred today filling a database with LAMP.
after some 150 inserts the sum calculation at the end of the page gave the same number of decimals.
,26000000000001
if i have time i'll search the php.net site.
but this is nun of your concern. thanks
I think that might have something to do with precision of decimals. Probably these decimals are the same in respect to the precision of these data types. Maybe you have to use another decimal type... (Unfortunately I don't know much about that issue, sorry.)