Bug #5016 Tip to solve encoding bugs
Submitted: 12 Aug 2004 11:41 Modified: 13 Aug 2004 4:23
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:0.76 OS:
Assigned to: Reggie Burnett CPU Architecture:Any

[12 Aug 2004 11:41] [ name withheld ]
Description:
The SplitSql method in the MySqlCommand class seems buggy.
If the 'sql' argument contains the ยง character wich is 0xA7 it will be saved as 0xFF, 0x27 in UTF8. (Or something like that.)

So the 'for' loop will catch 0x27 because it's the apostrophe character.

Futhermore, if each time you call Encoding.GetBytes, and then Stream.Write, it will be twice slower.

How to repeat:
Read the source code.

Suggested fix:
You should use a StreamWriter/StreamReader on top of the stream. Then you can parse the SQL query char by char, instead of byte by byte. It's a design problem.

Change at least both SplitSql and SerializeToBytes.

I haven't check how you retrieve data yet.

You should release a tarball of your current source code, because I didn't even know if you solved the bug.
[13 Aug 2004 4:23] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

The entire SplitSQL pattern has been redesigned and recoded to solve this and other problems.