List:MySQL++« Previous MessageNext Message »
From:Drew Vogel Date:December 12 2005 2:33pm
Subject:Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "d
View as plain text  
Warren Young wrote:

> Drew Vogel wrote:
>
>> On line 4 below, a BadConversion exception is thrown, with the what() 
>> message of:
>>
>>    Tried to convert "0.00P\uffffI" to a "d
>
>
> I don't know why the message is truncated.  Try the attached patch, to 
> see if the symptom changes.  It just changes the way this message is 
> constructed.
>
> As for why the error occurs, if the data truly is accurately 
> represented in that error, then there's no wonder it runs into a bad 
> conversion. That most definitely is not a valid double.  What do you 
> get when you use the basic 'mysql' command-line client to dump the 
> data from this row?  What if you try casting that fourth field to a 
> std::string instead?


I will try the patch later today. Here is a copy/paste of my mysql 
client output. When I cast the fourth field to a string, it doesn't 
throw the BadConversion error, but the data is still corrupt. If I 
select all of the columns in the table (named, not using *), the last 
column (wpc_bludgeoning) is corrupted. When I select just the four wpc_* 
columns, the data in the third column (wpc_chopping) corrupted. In both 
scenerios, it corrupts the data in the last or third rows, respectively, 
for both rows in the result set.


mysql> select * from character_classes;
+----+----------+------------+--------------+-------------+-------------+--------------+--------------+-----------------+
| id | name     | max_health | max_strength | max_agility | wpc_slicing 
| wpc_piercing | wpc_chopping | wpc_bludgeoning |
+----+----------+------------+--------------+-------------+-------------+--------------+--------------+-----------------+
|  1 | knight   |        100 |          100 |          75 |        0.01 
|       0.0075 |       0.0075 |          0.0075 |
|  2 | assassin |         90 |           80 |         100 |      0.0075 
|         0.01 |        0.005 |           0.005 |
+----+----------+------------+--------------+-------------+-------------+--------------+--------------+-----------------+
2 rows in set (0.09 sec)

mysql> select wpc_slicing, wpc_piercing, wpc_chopping, wpc_bludgeoning 
from character_classes;
+-------------+--------------+--------------+-----------------+
| wpc_slicing | wpc_piercing | wpc_chopping | wpc_bludgeoning |
+-------------+--------------+--------------+-----------------+
|        0.01 |       0.0075 |       0.0075 |          0.0075 |
|      0.0075 |         0.01 |        0.005 |           0.005 |
+-------------+--------------+--------------+-----------------+
2 rows in set (0.00 sec)

mysql> show create table character_classes;
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table             | Create 
Table                                                     |
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| character_classes | CREATE TABLE `character_classes` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` char(16) NOT NULL default '',
  `max_health` int(10) unsigned NOT NULL default '0',
  `max_strength` int(10) unsigned NOT NULL default '0',
  `max_agility` int(10) unsigned NOT NULL default '0',
  `wpc_slicing` double NOT NULL default '0',
  `wpc_piercing` double NOT NULL default '0',
  `wpc_chopping` double NOT NULL default '0',
  `wpc_bludgeoning` double NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.07 sec)


Drew Vogel
Thread
BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel11 Dec
  • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel11 Dec
  • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dWarren Young12 Dec
    • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel12 Dec
      • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dWarren Young12 Dec
        • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel12 Dec
          • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dWarren Young12 Dec
            • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel12 Dec
          • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel16 Dec
            • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dChris Frey19 Dec