Bug #6641 function CHAR
Submitted: 15 Nov 2004 16:24 Modified: 17 Nov 2004 17:36
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.1.12619 OS:Windows (XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[15 Nov 2004 16:24] [ name withheld ]
Description:
I have a table table1 with a tinyint field field1

Dim adapter As New MySqlDataAdapter
Dim Data as new DataSet

adapter.SelectCommand = New MySqlCommand("SELECT CHAR(field1) from table1", myconn)
adapter.Fill(Data)

I always have "" instead of my character corresponding to my ascii code

In version 1.0.0.22708, it's working correctly

How to repeat:
Always
[15 Nov 2004 16:43] Reggie Burnett
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Additional info:

I can't repeat this with code that I am about to release.  Here is the test case that I wrote to test this:

		[Test]
		public void CharFunction() 
		{
			execSQL("DROP TABLE IF EXISTS Test");
			createTable("CREATE TABLE Test (id tinyint)");
			execSQL("INSERT INTO Test VALUES (65)");

			MySqlDataAdapter da = new MySqlDataAdapter("SELECT CHAR(id) FROM Test", conn);
			DataTable dt = new DataTable();
			da.Fill(dt);
			Assert.AreEqual( "A", dt.Rows[0][0] );
		}
[16 Nov 2004 9:36] [ name withheld ]
It doesn't work when I use the keyword GROUP BY.

You can repeat this bug with this test code:

                [Test]
                public void CharFunction() 
                {
                        execSQL("DROP TABLE IF EXISTS Test");
                        createTable("CREATE TABLE Test (id tinyint,val1 tinyint,val2 tinyint)");
                        execSQL("INSERT INTO Test VALUES (65,1,1),(65,1,1)");

                        MySqlDataAdapter da = new MySqlDataAdapter("SELECT CHAR(id) FROM Test GROUP BY val1,val2", conn);
                        DataTable dt = new DataTable();
                        da.Fill(dt);
                        Assert.AreEqual( "A", dt.Rows[0][0] );
                }
[17 Nov 2004 14:38] Reggie Burnett
The unit test you sent in works perfectly for me on 4.0 and 4.1.  Perhaps this was fixed in 1.0.2.  Can you confirm that it is no longer a problem in 1.0.2?
[17 Nov 2004 17:18] [ name withheld ]
OK, bug fixed in version 1.0.2.
[17 Nov 2004 17:36] 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:

User reported back that bug is fixed in 1.0.2