Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1132

Inconsistency in getUpdateCount() Return Value for CREATE Statements

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.3.1
    • 3.3.2
    • batch
    • None

    Description

      When CREATE statements are executed through executeBatch(), the subsequent call to getUpdateCount() returns -1, which is inconsistent with the behavior observed when executing CREATE statements using the execute() method, where getUpdateCount() returns 0. This behavior is also inconsistent with the MySQL Connector/J, which returns 0 in both scenarios.

      @Test
      public void test() throws SQLException {
          Connection con = null;
          Statement stmt = null;
          con = DriverManager.getConnection("jdbc:mariadb://localhost:3366/test5?user=user&password=password");
          stmt = con.createStatement();
          stmt.addBatch("CREATE TABLE table211_0(id VARCHAR(5) PRIMARY KEY,value BOOL);");
          stmt.addBatch("CREATE TABLE table211_0(id TINYINT PRIMARY KEY,value SMALLINT);");
          try {
              stmt.executeBatch();
          } catch (Exception e) {
              System.out.println(e);
          }
          System.out.println(stmt.getUpdateCount()); // -1
      }
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            dwenking Wenqian Deng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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