Bug #40553 | Problem with MSAccess and Excel display of Varbinary | ||
---|---|---|---|
Submitted: | 6 Nov 2008 15:37 | Modified: | 7 Nov 2008 16:40 |
Reporter: | Fred S | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / ODBC | Severity: | S1 (Critical) |
Version: | 3.51.26 & 5.1.7 | OS: | Windows (2003 Server and XP) |
Assigned to: | CPU Architecture: | Any | |
Tags: | MSAccess, ODBC, varbinary |
[6 Nov 2008 15:37]
Fred S
[7 Nov 2008 7:59]
Tonci Grgin
Hi Fred and thanks for your report. Verified just as described. Now, what appears to be happening is that FLAG_NO_BINARY_RESULT works only for ad-hoc queries but not for table fields. I would call it expected behaviour but guys tell me it should work for tables too. Both c/ODBC versions affected. Server version: 5.0.68-pb10-log MySQL Pushbuild Edition, build 10 mysql> create table bug40553 SELECT CONCAT(1,9) AS Fld1; mysql> show create table bug40553; +----------+-------------------------------------------------------------------- --------------------------------------+ | Table | Create Table | +----------+-------------------------------------------------------------------- --------------------------------------+ | bug40553 | CREATE TABLE `bug40553` ( `Fld1` varbinary(2) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 | +----------+-------------------------------------------------------------------- --------------------------------------+ 1 row in set (0.00 sec) mysql> select * from bug40553; Field 1: `Fld1` Catalog: `def` Database: `test` Table: `bug40553` Org_table: `bug40553` Type: VAR_STRING Collation: binary (63) Length: 2 Max_length: 2 Decimals: 0 Flags: NOT_NULL BINARY +------+ | Fld1 | +------+ | 19 | +------+ 1 row in set (0.00 sec) odbcte32.exe: select * from bug40553 Return: SQL_SUCCESS=0 Get Data All: "bug40553.Fld1" 0x19 1 row fetched from 1 column. Access: MSACCESS 1b34-f04 ENTER SQLPrepareW HSTMT 08051FA0 WCHAR * 0x094D1AA8 [ -3] "SELECT `Fld1` FROM `bug40553` WHERE `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ? OR `Fld1` = ?\ 0" SDWORD -3 MSACCESS 1b34-f04 ENTER SQLBindParameter HSTMT 08051FA0 UWORD 1 SWORD 1 <SQL_PARAM_INPUT> SWORD 99 <SQL_C_DEFAULT> SWORD -3 <SQL_VARBINARY> SQLULEN 2 SWORD 0 PTR 0x094D1C14 SQLLEN 0 SQLLEN * 0x094D1C10 and so on MSACCESS 1b34-f04 ENTER SQLGetData HSTMT 08051FA0 UWORD 1 SWORD -2 <SQL_C_BINARY> PTR <unknown type> SQLLEN 512 SQLLEN * 0x0013CB98 and so on. For now, please use CAST AS CHAR to bypass the problem.
[7 Nov 2008 8:10]
Tonci Grgin
Sorry, have to overrule myself. It is as I suspected. FLAG_NO_BINARY_RESULT was introduced to bypass a flaw in MySQL server regarding metadata sent when using *functions* or *ad-hoc* queries and was never intended to change database fields. Please see Bug#10491 for explanation (quoting myself): Connector can't work around this, at least not reliably. Ad hoc user queries do not allow connector to distinguish between "SHOW CREATE TABLE", where it should treat BINARY as UTF8, and "SELECT varbinary_col FROM some_table", where it really should be binary. So as you see, the intention of FLAG_NO_BINARY_RESULT was never to change field type already present in table. Please use CAST or change your underlying table's field type.