Bug #42843 Concat_WS Value to returned to ASP.NET
Submitted: 13 Feb 2009 16:53 Modified: 13 Mar 2009 17:05
Reporter: Stuart Palmer Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version: OS:Windows
Assigned to: Assigned Account CPU Architecture:Any

[13 Feb 2009 16:53] Stuart Palmer
Description:
I'm using the following in a stored procedure:

SELECT
    CONCAT_WS(",",Bar, Disabled, Ensuite, Gym, Parking, Pool, Restaurant, WiFi) AS str_Features
  FROM
    tblFeatures
  WHERE
  (
    PropertyGUID = "8d952b74-4a7c-102c-84c6-c911f7a34a89"
   );

The tblFeatures values are set at boolean and str_Features set as:
OUT str_Features varchar(256)

MYSQL Query Analyser returns thes expcted string, however, when attempting to read this out in asp.net the string is empty. All my other Select return values correctly.

Is there an issue with doing what I am doing or a work around?

How to repeat:
SQL SP 'TEST'
------------------

Create table tblFeatures and record:
GUID varchar = "test"
Bar Boolean = 1
Restaurant Boolean = 0

STORED PROCEDURE
-----------------
CREATE PROCEDURE `Tester`.`TEST` (
  IN str_GUID varchar(45),
  OUT str_Features varchar(256))
BEGIN

  SELECT
    CONCAT_WS(",",Bar, Restaurant) AS str_Features
  FROM
    tblFeatures
  WHERE
  (
    GUID = str_GUID
   );

END $$

C# CODE
-------------
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "TEST";

cmd.Parameters.AddWithValue("@str_GUID", strPropertyGUID);
cmd.Parameters["@str_GUID"].Direction = ParameterDirection.Input;

cmd.Parameters.Add("@str_Features", MySqlDbType.VarChar);
cmd.Parameters["@str_Features"].Direction = ParameterDirection.Output;

cmd.ExecuteNonQuery();

string strFeatures = cmd.Parameters["@str_Features"].Value.ToString();

Response.Write("#" + strFeatures + "}");

//Response.Write("#" + strFeatures + "}"); - Returns an empty string
[13 Feb 2009 17:05] Tonci Grgin
Hi Stuart and thanks for your report.

However, test case is incomplete so I have to guess.
My first guess is that bug is filed in wrong category, should be c/NET.
My second guess, as I don't see connection string, is, if you're really using c/NET, you forgot to set "respect binary flags" to false. If you're using any other connector look for connection string option "return function results as strings" or similar.
Problem is well described in bugsdb, starting with Bug#10491. Your actual data is returned in form of "0xyour_correct_text".

Please check and report the result back.
[14 Mar 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".