Bug #30497 MYSQL ODBC READ WRITE PICTURE ERROR (80040e21)
Submitted: 19 Aug 2007 12:30 Modified: 20 Aug 2007 7:01
Reporter: jie zhang Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:3.51.19 OS:Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: MySQL, ODBC, READ WRITE PICTURE

[19 Aug 2007 12:30] jie zhang
Description:
MYSQL ODBC 3.51.19  READ WRITE PICTURE ERROR,  BUT IN 3.51.17 run fine.

EXAMPLE:

    If Not (mrstDatas.BOF And mrstDatas.EOF) Then
        If (vstrFileName = vbNullString) Or (Dir(vstrFileName) = vbNullString) Then
            mrstDatas.Fields(vstrFieldName).Value = Null
        Else
            mstrmDatas.Open
            mstrmDatas.LoadFromFile vstrFileName

            'ERROR  (80040e21)
            mrstDatas.Fields(vstrFieldName).Value = mstrmDatas.Read

            mstrmDatas.Close
        End If
        mrstDatas.Update
    End If

  

How to repeat:
  Always
[20 Aug 2007 7:01] Tonci Grgin
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.mysql.com/how-to-report.php

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.

Explanation: Hi Jie and thanks for another report. Please see bug#27117, for example, to find out how to write one.

In any case, I was unable to repeat the problem using:
 - MySQL 5.0.48pb1038 on WinXP Pro SP2 localhost
 - MyODBC 3.51.19GA
 - This test case:
        Dim I As Long
        Dim cx As New ADODB.Connection
        Dim rs As New ADODB.Recordset
        Dim stm As ADODB.Stream
        cx.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost;DATABASE=test;UID=root;PWD=***;OPTION=16427"
        cx.Open()
        cx.Execute("DROP TABLE IF EXISTS bug27117")
        cx.Execute("CREATE TABLE bug27117(ndx INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,picname VARCHAR(45),picture BLOB)")
        cx.Execute("INSERT INTO bug27117 (ndx) VALUES (NULL)")
        I = I + 1
        rs.CursorLocation = CursorLocationEnum.adUseClient
        rs.Properties("Update Criteria").Value = 0 'adCriteriaKey
        rs.Open("Select * from bug27117", cx, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockOptimistic)
        rs.AddNew()
        stm = New ADODB.Stream
        stm.Type = StreamTypeEnum.adTypeBinary
        stm.Open()
        stm.LoadFromFile(Application.StartupPath & "\testpicture.jpg")
        rs.Fields("picname").Value = "mitADD" & CStr(I)
        rs.Fields("picture").Value = stm.Read
        rs.Update()
        stm.Close()
        stm = Nothing
        rs.Close()