Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-47

Inconsistent data if blob field fetched in parts with SQLGetData

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.12
    • Component/s: None
    • Labels:
      None

      Description

      ODBC_TEST(t_blob_reading_in_chunks)
      {
      SQLLEN valueLen;
      SQLCHAR value[12];
      int i= 0;

      OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS blob_reading");
      OK_SIMPLE_STMT(Stmt,
      "CREATE TABLE blob_reading (id INT unsigned not null primary key auto_increment, value mediumblob)");

      OK_SIMPLE_STMT(Stmt, "INSERT INTO blob_reading(value) VALUES (0x0102030405060708090a0b0c0d0e0f101112131415161718)");

      OK_SIMPLE_STMT(Stmt, "SELECT value FROM blob_reading");

      CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
      EXPECT_STMT(Stmt, SQLGetData(Stmt, 1, SQL_C_BINARY, value, sizeof(value), &valueLen), SQL_SUCCESS_WITH_INFO);
      check_sqlstate(Stmt, "01004");

      is_num(valueLen, 24);

      for (;i < 12; ++i)

      { diag("#%d", i); is_num(value[i], i + 1); }

      CHECK_STMT_RC(Stmt, SQLGetData(Stmt, 1, SQL_C_BINARY, value, sizeof(value), &valueLen));
      is_num(valueLen, 12);
      for (;i < 24; ++i)

      { diag("#%d", i); is_num(value[i - 12], i + 1); }

      EXPECT_STMT(Stmt, SQLFetch(Stmt), SQL_NO_DATA);

      OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS blob_reading");

      return OK;
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Lawrin Lawrin Novitsky
              Reporter:
              Lawrin Lawrin Novitsky
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration