=== modified file 'ChangeLog' --- ChangeLog 2010-03-01 22:45:48 +0000 +++ ChangeLog 2010-03-07 20:21:28 +0000 @@ -8,6 +8,8 @@ Bugs fixed: * If NO_BACKSLASH_ESCAPES mode is used on a server, escaping binary data can lead to server query parsing errors. (Bug #49029) + * SQLColumns returns wrong value for database and several other flds. + (Bug #34272) ---- === modified file 'driver/catalog.c' --- driver/catalog.c 2010-01-31 00:29:06 +0000 +++ driver/catalog.c 2010-03-07 21:23:27 +0000 @@ -490,7 +490,7 @@ MYODBC_FIELD_STRING("TABLE_NAME", NAME_LEN, NOT_NULL_FLAG), MYODBC_FIELD_STRING("COLUMN_NAME", NAME_LEN, NOT_NULL_FLAG), MYODBC_FIELD_SHORT("DATA_TYPE", NOT_NULL_FLAG), - MYODBC_FIELD_STRING("TYPE_NAME", 20, NOT_NULL_FLAG), + MYODBC_FIELD_STRING("TYPE_NAME", 20*SYSTEM_CHARSET_MBMAXLEN, NOT_NULL_FLAG), MYODBC_FIELD_LONG("COLUMN_SIZE", 0), MYODBC_FIELD_LONG("BUFFER_LENGTH", 0), MYODBC_FIELD_SHORT("DECIMAL_DIGITS", 0), @@ -502,7 +502,7 @@ MYODBC_FIELD_SHORT("SQL_DATETIME_SUB", 0), MYODBC_FIELD_LONG("CHAR_OCTET_LENGTH", 0), MYODBC_FIELD_LONG("ORDINAL_POSITION", NOT_NULL_FLAG), - MYODBC_FIELD_STRING("IS_NULLABLE", 3, 0), + MYODBC_FIELD_STRING("IS_NULLABLE", 3*SYSTEM_CHARSET_MBMAXLEN, 0), }; const uint SQLCOLUMNS_FIELDS= array_elements(SQLCOLUMNS_values); === modified file 'test/my_catalog.c' --- test/my_catalog.c 2010-01-31 00:29:06 +0000 +++ test/my_catalog.c 2010-03-07 21:20:35 +0000 @@ -1443,7 +1443,44 @@ } +/* + Bug #34272 - SQLColumns returned wrong values for (some) TYPE_NAME + and (some) IS_NULLABLE +*/ +DECLARE_TEST(t_bug34272) +{ + SQLCHAR dummy[20]; + SQLULEN col6, col18, length; + + ok_sql(hstmt, "drop table if exists t_bug34272"); + ok_sql(hstmt, "create table t_bug34272 (x int unsigned)"); + + ok_stmt(hstmt, SQLColumns(hstmt, NULL, SQL_NTS, NULL, SQL_NTS, + (SQLCHAR *)"t_bug34272", SQL_NTS, NULL, 0)); + + ok_stmt(hstmt, SQLDescribeCol(hstmt, 6, dummy, sizeof(dummy), NULL, NULL, + &col6, NULL, NULL)); + ok_stmt(hstmt, SQLDescribeCol(hstmt, 18, dummy, sizeof(dummy), NULL, NULL, + &col18, NULL, NULL)); + ok_stmt(hstmt, SQLFetch(hstmt)); + + ok_stmt(hstmt, SQLGetData(hstmt, 6, SQL_C_CHAR, dummy, col6+1, &length)); + is_num(length,16); + is_str(dummy, "integer unsigned", length+1); + + ok_stmt(hstmt, SQLGetData(hstmt, 18, SQL_C_CHAR, dummy, col18+1, &length)); + is_num(length,3); + is_str(dummy, "YES", length+1); + + ok_stmt(hstmt, SQLFreeStmt(hstmt,SQL_CLOSE)); + ok_sql(hstmt, "drop table if exists t_bug34272"); + + return OK; +} + + BEGIN_TESTS + ADD_TEST(my_columns_null) ADD_TEST(my_drop_table) ADD_TEST(my_table_dbs) @@ -1473,6 +1510,7 @@ ADD_TEST(t_bug30770) ADD_TEST(t_bug36275) ADD_TEST(t_bug39957) + ADD_TEST(t_bug34272) END_TESTS