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

BULK with replace doesn't take the first parameter in account

    Details

      Description

      When using COM_STMT_BULK_EXECUTE , the first "couple" are not taken in account.

              Statement stmt = sharedConnection.createStatement();
              stmt.execute("CREATE TEMPORARY TABLE test_replace (id int not null primary key, active BOOLEAN)")    
              stmt.execute("insert into test_replace values (1, false), (2, false), (3, false)");
       
              try (PreparedStatement preparedStatement = sharedConnection.prepareStatement("replace into test_replace (id, active) values (?, ?)")) {
                  preparedStatement.setInt(1, 1);
                  preparedStatement.setBoolean(2, true);
                  preparedStatement.addBatch();
                  preparedStatement.setInt(1, 2);
                  preparedStatement.setBoolean(2, true);
                  preparedStatement.addBatch();
                  preparedStatement.setInt(1, 3);
                  preparedStatement.setBoolean(2, true);
                  preparedStatement.addBatch();
                  preparedStatement.setInt(1, 4);
                  preparedStatement.setBoolean(2, true);
                  preparedStatement.addBatch();
                  preparedStatement.executeBatch();
              }
      

      expected in database :

                  1 true
                  2 true
                  3 true
                  4 true
      

      but is

                  1 false
                  2 true
                  3 true
                  4 true
      

      The byte send to server are ok, according to COM_STMT_BULK_EXECUTE protocol :

      27 00 00 00 FA 01 00 00  00 80 FF 03 00 01 00 00     '...............
      01 00 00 00 00 01 00 02  00 00 00 00 01 00 03 00     ................
      00 00 00 01 00 04 00 00  00 00 01                    ...........
      

      (tested with server 10.3.7 and 10.2.14)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                diego dupin Diego Dupin
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: