Possible data corruption in MySQL

Markus Hoenicka <[email protected]> Wed, 12 Dec 2007 11:03:39 +0100
Newsgroups gmane.text.refdb.general
Message-ID <[email protected]>
Hi all,

I'd like to make you aware of a problem with the libdbi MySQL driver  
which you are using if you run MySQL as your database engine for  
RefDB. There is a bug which may screw up your data under the following  
circumstances (other scenarios are possible though):

1) Your database uses UTF-8 encoding

2) You store multibyte characters (like UTF-8 umlauts)

Now what happens is that the MySQL driver incorrectly causes the data  
to be transformed to "UTF-8" again, making umlauts take up 4 instead  
of 2 bytes. If you retrieve your data with RefDB again, the problem  
may be silent as the data are transformed back again. Assume your  
dataset with the ID 1 has an author called "Bäuml". Using the current  
MySQL driver the author name will be stored with the umlaut "ä"  
encoded as 4 byte.

1) if you retrieve the dataset using "getref :ID:=1", the query will  
succeed, and the author will be returned as "Bäuml" with the "ä"  
taking up 2 byte.

2) if you attempt to retrieve the dataset using "getref :AX:~Bäuml",  
the query will fail as the "ä" in your query string uses 2 bytes  
whereas the author name in the database uses 4 bytes for the same  
character.

A fixed version of the MySQL driver will be available shortly. It is  
important to understand that you have to export your data using the  
current version of the MySQL driver and reimport the data using the  
new driver if you upgrade your libdbi drivers.

Please do not hesitate to seek assistance if you attempt to upgrade  
your installation.

regards,
Markus


-- 
Markus Hoenicka
[email protected]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php