Bug #52718 respect binary flags=false does not work for results of GROUP_CONCAT()

Submitted: 9 Apr 2010 12:13 Modified: 16 Apr 2010 1:01
Reporter: Bogdan Degtyariov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.2.2 OS:Any
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: BINARY, metadata, respect binary flags

[9 Apr 2010 12:13] Bogdan Degtyariov
Description:
Connector/NET 6.2.2 returns result of GROUP_CONCAT() as byte sequence instead of string. Setting "respect binary flags=false" does not help.

How to repeat:
Test case:

    private void button7_Click_1(object sender, EventArgs e)
    {
      MySqlConnection con = new MySqlConnection();
      try
      {
        con.ConnectionString = "server=localhost;database=test;" +
                               "user id=****;Password=*****;" +
                               "respect binary flags=false;";
        con.Open();

        MySqlCommand cmd = new MySqlCommand();
        cmd.Connection = con;

        cmd.CommandType = CommandType.Text;
        cmd.CommandText = "drop table if exists test_group_concat";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "create table test_group_concat (id int);";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "insert into test_group_concat (id) values " +
                          "(1),(2),(3),(4),(5),(6);";
        cmd.ExecuteNonQuery();

        cmd.CommandText = "SELECT GROUP_CONCAT(DISTINCT id) AS testid " +
                          "FROM test_group_concat;";
        MySqlDataReader dr = cmd.ExecuteReader();

        while(dr.Read())
          MessageBox.Show("RESULT:" + dr[0]);

      }
      catch (Exception ex)
      {
        string error = ex.Message.ToString();
        error += ex.StackTrace;
        MessageBox.Show(error);
      }
      finally
      {
        if (con != null)
          con.Close();
      }

    }
[16 Apr 2010 1:01] Reggie Burnett
This is not a bug.  Respect binary flags is about returning a value that matches what the metadata says it is.  In this case, GROUP_CONCAT is returning binary metadata.

What you want in your connection string is "functions return string=yes" which forces the output of functions to be string.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.