Bug #83734 Build WHERE -> insert_fields() failed when updating BLOB field with MyODBC
Submitted: 8 Nov 2016 4:51 Modified: 8 Jun 2018 11:52
Reporter: Luis A S Junior Camargo Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.3.8 OS:Microsoft Windows (Server 2008 32bits)
Assigned to: CPU Architecture:Any
Tags: ASP ODBC BLOB UPDATE

[8 Nov 2016 4:51] Luis A S Junior Camargo
Description:
I use a function to update a BLOB field working for more then teen years with MyODBC 3.51.12.

I have using Windows Server 2008 32 bits (IIS 7.0) with Classic ASP and MyODBC Connector 5.3.6.

The MySQL server version is 5.6.34 64 bits running in other server, into Windows 10.

In have installed the MyODBC versions 3.51.12, 5.1.13, 5.2.7 and 5.3.6.

With version 3.51.12 working fine, with 5.1.13, 5.2.7 or 5.3.6 all returning this error:

=================================================================
Microsoft OLE DB Provider for ODBC Drivers erro '80004005'

[MySQL][ODBC 5.3(w) Driver][mysqld-5.6.34-log]Build WHERE -> insert_fields() failed.
=================================================================

How to repeat:
Install a MyODBC 5.3.6 in Windows.

============================================

In console, create a test table:
============================================

CREATE TABLE `testtable` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`file` MEDIUMBLOB NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin1_swedish_ci'
ENGINE=MyISAM
;

============================================

Create a ASP file (test.asp) with:
============================================
BEGIN TEST.ASP

<%
wstring="DRIVER={MySQL ODBC 5.3 Unicode Driver};SERVER=127.0.0.1;PORT=3306;DATABASE=test;UID=testuser;PWD=testpass;OPTION=16427"
Set connec=server.createobject("adodb.connection")
connec.Open wstring

sql="delete from testtable where id=1"
set xx=connec.execute(sql)
set xx=nothing

sql="insert into testtable (id,file) values (1,'')"
set xx=connec.execute(sql)
set xx=nothing

Const adOpenStatic = 3
Const adLockOptimistic = 3

Set Rs = Server.CreateObject("ADODB.Recordset")
Set Rs.ActiveConnection = connec

Rs.CursorType = adOpenStatic
Rs.LockType = adLockOptimistic

xsource="select file from testtable where id=1"
Rs.Source = xsource
Rs.Open
        
Const adTypeBinary = 1
  
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")

BinaryStream.Type = adTypeBinary

BinaryStream.Open
  
BinaryStream.LoadFromFile "image.jpg"
  
ReadBinaryFile = BinaryStream.Read

RS("file").AppendChunk ReadBinaryFile
RS.Update
         
set ReadBinaryFile=nothing
            
BinaryStream.close
set BinaryStream=nothing

connec.close
set connec=nothing
%>

END TEST.ASP
=====================================

Save any small image file in same folder of test.asp with name image.jpg and execute the test.asp in browser for run the application.

The error occurs in line:
RS.Update

Microsoft OLE DB Provider for ODBC Drivers erro '80004005'

[MySQL][ODBC 5.3(w) Driver][mysqld-5.6.34-log]Build WHERE -> insert_fields() failed.

Suggested fix:
Any update between Connector/ODBC version 3.51.12 and (5.1.13, 5.2.7, 5.3.6) has introduced this problem.
[21 Nov 2016 7:48] Chiranjeevi Battula
Hello  Luis,

Thank you for the bug report.
I could not repeat the issue at our end using with Connector / ODBC 5.3.6 version and max_allowed_packet parameter set to "128M".
Could you please provide repeatable test case (exact steps, my.ini file, screenshot etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[17 Dec 2016 16:51] Luis A S Junior Camargo
Hi,

For information, now i have updated MySQL Server from 5.6.34 to 5.7.17, and ODBC from 5.3.6 to 5.3.7 and the problem is identical as Server 5.6.34 with ODBC 5.3.6.

This is a error with Server 5.7.17 and ODBC 5.3.7:

Microsoft OLE DB Provider for ODBC Drivers erro '80004005'

[MySQL][ODBC 5.3(w) Driver][mysqld-5.7.17-log]Build WHERE -> insert_fields() failed. 

===============================================================

MySQL Server 5.7.17 with ODBC 3.51.12 working without problems.
MySQL Server 5.6.34 with ODBC 3.51.12 working without problems.

MySQL Server 5.6.x or 5.7.x with ODBC versions after 3.51.12 (5.1.x, 5.2.x or 5.3.x) has error.

thanks
[20 Dec 2016 12:25] Chiranjeevi Battula
Hello  Luis,

Thank you for the bug feedback.
I'm glad that you resolved your problem by moving to Connector / ODBC 5.3.7 version.

Thanks,
Chiranjeevi.
[20 Dec 2016 12:56] Luis A S Junior Camargo
Hello Chiranjeevi,

The problem continues with Connector / ODBC 5.3.7 version.

Thanks,
Luis
[2 May 2017 2:29] Luis A S Junior Camargo
The problem continues with latest versions MySQL Server 5.7.18 and MyODBC 5.3.8
[8 Jun 2018 11:52] Chiranjeevi Battula
Hello  Luis,

Thank you for the bug feedback.
I could not repeat the issue at our end using with Connector/ODBC 8.0.11 64 bit version.
If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Thanks,
Chiranjeevi.