Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 3.1.1
    • None
    • None
    • ODBC 3.1.1 with MariaDB 10.3.15 under Windows Server 2008

    Description

      I use a function to update a BLOB field working for more then teen years with MyODBC 3.51.12, now i have try with MariaODBC 3.1.1, but a error has show.

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

      The MariaDB version is 10.3.15 64 bits running in other server, into Windows 10 64 bits.

      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.
      =====================================

      With MariaODBC 3.1.1, this is a error:

      ==========================
      Microsoft OLE DB Provider for ODBC Drivers erro '80004005'
      [ma-3.1.1][10.3.15-MariaDB]Can't build index for update/delete
      ==========================

      How to repeat:

      • Install a MariaODBC 3.1.1 in Windows.
      • 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=

      {MariaDB ODBC 3.1 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

      Attachments

        1. image.jpg
          image.jpg
          37 kB
        2. SQL-create-table.txt
          0.2 kB
        3. test.asp
          1 kB

        Activity

          Thank you for your report.

          This can be a duplicate of the ODBC-102. But there mysql's connector reportedly works. And in your case only some its old version works.

          Would it be possible to provide ODBC trace for your issue?

          Lawrin Lawrin Novitsky added a comment - Thank you for your report. This can be a duplicate of the ODBC-102 . But there mysql's connector reportedly works. And in your case only some its old version works. Would it be possible to provide ODBC trace for your issue?

          The workaround would be to add id field to the field list in the 'select' statement

          Lawrin Lawrin Novitsky added a comment - The workaround would be to add id field to the field list in the 'select' statement

          I am actually not sure if we should fix this.
          We cannot be sure, that we update the correct row. Or that we update only that row, and not any other.
          In your case WHERE clause unambiguously determines the row. But that is not always granted.
          And we will have to compare in the composed WHERE clause mediumblob field with its the current value in connector's result buffer.
          Let aside, that separating WHERE clause from the query is not that trivial task for a connector.
          At the end we will have bad and bugs prone solution, while there is good workaround without all these drawbacks.

          Lawrin Lawrin Novitsky added a comment - I am actually not sure if we should fix this. We cannot be sure, that we update the correct row. Or that we update only that row, and not any other. In your case WHERE clause unambiguously determines the row. But that is not always granted. And we will have to compare in the composed WHERE clause mediumblob field with its the current value in connector's result buffer. Let aside, that separating WHERE clause from the query is not that trivial task for a connector. At the end we will have bad and bugs prone solution, while there is good workaround without all these drawbacks.

          People

            Lawrin Lawrin Novitsky
            lascjr Luis A S C Junior
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.