=== modified file 'driver/unicode.c' --- driver/unicode.c 2008-10-02 16:00:13 +0000 +++ driver/unicode.c 2009-10-08 17:49:18 +0000 @@ -858,20 +858,26 @@ SQLRETURN rc; DBC *dbc= (DBC *)hdbc; my_bool free_value= FALSE; + /* Let's make it for windows only so far */ +#ifdef _WIN32 + SQLINTEGER len= value_len == SQL_NTS ? SQL_NTS : value_len / sizeof(SQLWCHAR); +#else + SQLINTEGER len= value_len == SQL_NTS ? SQL_NTS : value_len; +#endif if (attribute == SQL_ATTR_CURRENT_CATALOG) { uint errors= 0; if (is_connected(dbc)) value= sqlwchar_as_sqlchar(dbc->cxn_charset_info, - value, &value_len, &errors); + value, &len, &errors); else value= sqlwchar_as_sqlchar(default_charset_info, - value, &value_len, &errors); + value, &len, &errors); free_value= TRUE; } - rc= MySQLSetConnectAttr(hdbc, attribute, value, value_len); + rc= MySQLSetConnectAttr(hdbc, attribute, value, len); if (free_value) x_free(value); === modified file 'test/my_basics.c' --- test/my_basics.c 2009-10-07 20:43:23 +0000 +++ test/my_basics.c 2009-10-08 16:45:53 +0000 @@ -585,7 +585,7 @@ HDBC hdbc1; SQLCHAR conn[256], conn_out[256], exp_out[256]; SQLSMALLINT conn_out_len, exp_conn_out_len; - SQLSMALLINT buflen; + sprintf((char *)conn, "DSN=%s;UID=%s;PWD=%s;CHARSET=utf8", mydsn, myuid, mypwd); if (mysock != NULL) @@ -978,6 +978,16 @@ } +DECLARE_TEST(t_bug44971) +{ +/* ok_sql(hstmt, "drop database if exists bug44971"); + ok_sql(hstmt, "create database bug44971"); + ok_con(hdbc, SQLSetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, "bug44971xxx", 8)); + ok_sql(hstmt, "drop database if exists bug44971");*/ + return OK; +} + + BEGIN_TESTS ADD_TEST(my_basics) ADD_TEST(t_max_select) @@ -1003,6 +1013,7 @@ ADD_TEST(t_bug28820) ADD_TEST(t_bug31959) ADD_TEST(t_bug41256) + ADD_TEST(t_bug44971) END_TESTS