Index: ChangeLog =================================================================== --- ChangeLog (revision 736) +++ ChangeLog (working copy) @@ -3,6 +3,7 @@ Functionality added or changed: Bugs fixed: + * The wrong column size was returned for binary data. (Bug #30547) * SQLGetData() will now always return SQL_NO_DATA_FOUND on second call when no data left, even if requested size is 0. (Bug#30520) * SQLSetParam() caused memory allocation errors due to driver manager's Index: driver/utility.c =================================================================== --- driver/utility.c (revision 736) +++ driver/utility.c (working copy) @@ -631,11 +631,11 @@ case MYSQL_TYPE_BIT: /* We treat a BIT(n) as a SQL_BIT if n == 1, otherwise we treat it - as a SQL_BINARY, so length is (bits + 7) / 8. * 2 + as a SQL_BINARY, so length is (bits + 7) / 8. */ if (length == 1) return 1; - return (length + 7) / 8 * 2; + return (length + 7) / 8; case MYSQL_TYPE_ENUM: case MYSQL_TYPE_SET: @@ -648,7 +648,7 @@ case MYSQL_TYPE_BLOB: case MYSQL_TYPE_GEOMETRY: if (field->charsetnr == 63) - return length * 2; + return length; else return length / mbmaxlen; } Index: test/my_basics.c =================================================================== --- test/my_basics.c (revision 736) +++ test/my_basics.c (working copy) @@ -303,7 +303,7 @@ is_num(my_fetch_int(hstmt1, 16), 30); ok_stmt(hstmt1, SQLFetch(hstmt1)); - is_num(my_fetch_int(hstmt1, 7), 20); + is_num(my_fetch_int(hstmt1, 7), 10); is_num(my_fetch_int(hstmt1, 8), 10); is_num(my_fetch_int(hstmt1, 16), 10); Index: test/my_types.c =================================================================== --- test/my_types.c (revision 736) +++ test/my_types.c (working copy) @@ -665,7 +665,7 @@ is_str(my_fetch_str(hstmt, col, 4), "b", 1); is_num(my_fetch_int(hstmt, 5), SQL_BINARY); /* DATA_TYPE */ - is_num(my_fetch_int(hstmt, 7), 6); /* COLUMN_SIZE */ + is_num(my_fetch_int(hstmt, 7), 3); /* COLUMN_SIZE */ is_num(my_fetch_int(hstmt, 8), 3); /* BUFFER_LENGTH */ is_num(my_fetch_int(hstmt, 16), 3); /* CHAR_OCTET_LENGTH */ Index: test/my_result.c =================================================================== --- test/my_result.c (revision 736) +++ test/my_result.c (working copy) @@ -337,7 +337,7 @@ is(desc_col_check(hstmt, 10, "c10", SQL_REAL, 7, 7, 0, SQL_NULLABLE) == OK); is(desc_col_check(hstmt, 11, "c11", SQL_BIGINT, 19, 19, 0, SQL_NO_NULLS) == OK); - is(desc_col_check(hstmt, 12, "c12", SQL_VARCHAR, 24, 24, 0, SQL_NULLABLE) == OK); + is(desc_col_check(hstmt, 12, "c12", SQL_VARCHAR, 12, 12, 0, SQL_NULLABLE) == OK); is(desc_col_check(hstmt, 13, "c13", SQL_CHAR, 20, 20, 0, SQL_NO_NULLS) == OK); is(desc_col_check(hstmt, 14, "c14", SQL_REAL, 7, 7, 0, SQL_NULLABLE) == OK); @@ -345,11 +345,11 @@ is(desc_col_check(hstmt, 16, "c16", SQL_LONGVARCHAR, 65535, 65535, 0, SQL_NULLABLE) == OK); is(desc_col_check(hstmt, 17, "c17", SQL_LONGVARCHAR, 16777215, 16777215, 0, SQL_NULLABLE) == OK); is(desc_col_check(hstmt, 18, "c18", SQL_LONGVARCHAR, 4294967295 , 16777215 , 0, SQL_NULLABLE) == OK); - is(desc_col_check(hstmt, 19, "c19", SQL_LONGVARBINARY, 255 * 2, 255, 0, SQL_NULLABLE) == OK); - is(desc_col_check(hstmt, 20, "c20", SQL_LONGVARBINARY, 65535 * 2, 65535, 0, SQL_NULLABLE) == OK); - is(desc_col_check(hstmt, 21, "c21", SQL_LONGVARBINARY, 16777215 * 2, 16777215, 0, SQL_NULLABLE) == OK); - is(desc_col_check(hstmt, 22, "c22", SQL_LONGVARBINARY, 4294967295 * 2 , 16777215 , 0, SQL_NULLABLE) == OK); - is(desc_col_check(hstmt, 23, "c23", SQL_LONGVARBINARY, 255 * 2, 5, 0, SQL_NULLABLE) == OK); + is(desc_col_check(hstmt, 19, "c19", SQL_LONGVARBINARY, 255, 255, 0, SQL_NULLABLE) == OK); + is(desc_col_check(hstmt, 20, "c20", SQL_LONGVARBINARY, 65535, 65535, 0, SQL_NULLABLE) == OK); + is(desc_col_check(hstmt, 21, "c21", SQL_LONGVARBINARY, 16777215, 16777215, 0, SQL_NULLABLE) == OK); + is(desc_col_check(hstmt, 22, "c22", SQL_LONGVARBINARY, 4294967295 , 16777215 , 0, SQL_NULLABLE) == OK); + is(desc_col_check(hstmt, 23, "c23", SQL_LONGVARBINARY, 255, 5, 0, SQL_NULLABLE) == OK); ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));