Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25839

Wrong data saved on EXECUTE when second use COM_STMT_SEND_LONG_DATA when first didn't

    XMLWordPrintable

    Details

      Description

      This only concerns 10.3+ version. Bug is not present in 10.2.

      On second execution of COM_STMT_EXECUTE that have a COM_STMT_SEND_LONG_DATA value, when first execution didn't and type differ, data inserted isn't correct.

      example to reproduced :

              try (Connection con = DriverManager.getConnection(
                      "jdbc:mariadb://localhost:3304/testj?useServerPrepStmts&log",
                      "root",
                      "")) {
                  Statement stmt = con.createStatement();
                  stmt.execute("DROP TABLE IF EXISTS myTable");
                  stmt.execute("CREATE TABLE myTable (a LONGTEXT)");
       
                  try (PreparedStatement ps = con.prepareStatement("INSERT INTO myTable (a) VALUES (?)")) {
                      ps.setInt(1, 1);
                      ps.execute();
       
                      Reader reader2 = new StringReader("2");
                      ps.setCharacterStream(1, reader2);
                      ps.execute();
                  }
       
                  ResultSet rs = stmt.executeQuery("SELECT * FROM myTable");
                  rs.next();
                  assertEquals("1", rs.getString(1));
                  rs.next();
                  assertEquals("2", rs.getString(1)); // return unexpected value '94448646608768'
       
              }
      

        Attachments

          Activity

            People

            Assignee:
            shulga Dmitry Shulga
            Reporter:
            diego dupin Diego Dupin
            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.