Modified:
trunk/ChangeLog
trunk/driver/utility.c
trunk/test/my_basics.c
trunk/test/my_result.c
trunk/test/my_types.c
Log:
The wrong column size was returned for binary data. (Bug #30547)
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-09-05 17:50:36 UTC (rev 737)
+++ trunk/ChangeLog 2007-09-05 18:44:46 UTC (rev 738)
@@ -3,6 +3,7 @@
Functionality added or changed:
Bugs fixed:
+ * The wrong column size was returned for binary data. (Bug #30547)
* The specified length of the username and authentication parameters to
SQLConnect() were not being honored. (Bug #30774)
* SQLGetData() will now always return SQL_NO_DATA_FOUND on second call
Modified: trunk/driver/utility.c
===================================================================
--- trunk/driver/utility.c 2007-09-05 17:50:36 UTC (rev 737)
+++ trunk/driver/utility.c 2007-09-05 18:44:46 UTC (rev 738)
@@ -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;
}
Modified: trunk/test/my_basics.c
===================================================================
--- trunk/test/my_basics.c 2007-09-05 17:50:36 UTC (rev 737)
+++ trunk/test/my_basics.c 2007-09-05 18:44:46 UTC (rev 738)
@@ -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);
Modified: trunk/test/my_result.c
===================================================================
--- trunk/test/my_result.c 2007-09-05 17:50:36 UTC (rev 737)
+++ trunk/test/my_result.c 2007-09-05 18:44:46 UTC (rev 738)
@@ -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));
Modified: trunk/test/my_types.c
===================================================================
--- trunk/test/my_types.c 2007-09-05 17:50:36 UTC (rev 737)
+++ trunk/test/my_types.c 2007-09-05 18:44:46 UTC (rev 738)
@@ -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 */
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r738 - in trunk: . driver test | jwinstead | 5 Sep |