Bug #59305 mysql_real_connect with wchar_t types
Submitted: 5 Jan 2011 10:03 Modified: 31 Jan 2011 8:07
Reporter: Shrikrishna Bhat Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:6.0.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: wchar_t C API

[5 Jan 2011 10:03] Shrikrishna Bhat
Description:
On following API, I see char* for most of the parameter.

MYSQL *		STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
					   const char *user,
					   const char *passwd,
					   const char *db,
					   unsigned int port,
					   const char *unix_socket,
					   unsigned long clientflag);

If I want to pass wchar_t instead of char*, then what I suppose to do. Hope this bug or request might have raised or know much earlier. 
How C API supports white characters?

How to repeat:
Try to call mysql_real_connect API with wchar_t datatype for hostname or user or password or db:

wchar_t hostName = L"host";
mysql_real_connect(mysql, hostName,user,passwd,db,port,unix_socket,clientflag)
[31 Jan 2011 8:07] Bogdan Degtyariov
Hi Shrikrishna,

Unfortunately, MySQL C API function mysql_real_connect() does not support wchar_t types for parameters. In order to use mysql_real_connect() you have to convert wchar_t to char.

I am not sure if mysql_real_connect() will ever accept wchar_t.

Setting "not a bug" status.