Package java.sql

Examples of java.sql.PreparedStatement.addBatch()


            s.setString(2, destination.getQualifiedName());
            s.setString(3, clientId);
            s.setString(4, subscriptionName);
            s.setLong(5, prio);
            if (this.batchStatments) {
                s.addBatch();
            } else if (s.executeUpdate() != 1) {
                throw new SQLException("Failed update last ack with priority: " + prio + ", for sub: " + subscriptionName);
            }
        } finally {
            cleanupExclusiveLock.readLock().unlock();
View Full Code Here


            s.setString(2, destination.getQualifiedName());
            s.setString(3, clientId);
            s.setString(4, subscriptionName);

            if (this.batchStatments) {
                s.addBatch();
            } else if (s.executeUpdate() != 1) {
                throw new IOException("Could not update last ack seq : "
                            + seq + ", for sub: " + subscriptionName);
            }
        } finally {
View Full Code Here

        insertPropertiesStatement.setLong(1, eventId);
        insertPropertiesStatement.setString(2, key);
        insertPropertiesStatement.setString(3, value);

        if (cnxSupportsBatchUpdates) {
          insertPropertiesStatement.addBatch();
        } else {
          insertPropertiesStatement.execute();
        }
      }
View Full Code Here

        Set<String> includedPerms = new HashSet<>();
        PreparedStatement statement = conn.prepAndBind("entity.permissions.add", this.getIdentifier(), "toset", worldName, this.type.ordinal());
        for (int i = permissions.size() - 1; i >= 0; i--) { // insert in reverse order
          if (!includedPerms.contains(permissions.get(i))) {
            statement.setString(2, permissions.get(i));
            statement.addBatch();
            includedPerms.add(permissions.get(i));
          }
        }
        statement.executeBatch();
      }
View Full Code Here

        final String group = parents.get(i);
        if (group == null || group.isEmpty()) {
          continue;
        }
        statement.setString(2, group);
        statement.addBatch();
      }
      statement.executeBatch();
    } catch (SQLException | IOException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

        try (SQLConnection conn = getSQL()) {
          PreparedStatement updateStmt = conn.prep("entity.options.add");
          ResultSet res = conn.prepAndBind("SELECT `name`, `type` FROM `{permissions_entity}` WHERE `default`='1'").executeQuery();
          while (res.next()) {
              conn.bind(updateStmt, res.getString("name"), res.getInt("type"), "default", "", "true");
              updateStmt.addBatch();
          }
          updateStmt.executeBatch();

          // Update tables
          conn.prep("ALTER TABLE `{permissions_entity}` DROP COLUMN `default`").execute();
View Full Code Here

          ResultSet res = conn.prepAndBind("SELECT `name`, `type`, `prefix`, `suffix` FROM `{permissions_entity}` WHERE LENGTH(`prefix`)>0 OR LENGTH(`suffix`)>0").executeQuery();
          while (res.next()) {
            String prefix = res.getString("prefix");
            if (!prefix.isEmpty() && !prefix.equals("null")) {
              conn.bind(updateStmt, res.getString("name"), res.getInt("type"), "prefix", "", prefix);
              updateStmt.addBatch();
            }
            String suffix = res.getString("suffix");
            if (!suffix.isEmpty() && !suffix.equals("null")) {
              conn.bind(updateStmt, res.getString("name"), res.getInt("type"), "suffix", "", suffix);
              updateStmt.addBatch();
View Full Code Here

              updateStmt.addBatch();
            }
            String suffix = res.getString("suffix");
            if (!suffix.isEmpty() && !suffix.equals("null")) {
              conn.bind(updateStmt, res.getString("name"), res.getInt("type"), "suffix", "", suffix);
              updateStmt.addBatch();
            }
          }
          updateStmt.executeBatch();

          // Data type corrections
View Full Code Here

      conn.prepAndBind("DELETE FROM `{permissions_inheritance}` WHERE `child` = ? AND `type` = ?", worldName, SQLData.Type.WORLD.ordinal()).execute();

      PreparedStatement statement = conn.prepAndBind("INSERT INTO `{permissions_inheritance}` (`child`, `parent`, `type`) VALUES (?, ?, ?)", worldName, "toset", SQLData.Type.WORLD.ordinal());
      for (String parentWorld : parentWorlds) {
        statement.setString(2, parentWorld);
        statement.addBatch();
      }
      statement.executeBatch();

      this.worldInheritanceCache.put(worldName, parentWorlds);
View Full Code Here

    assertFalse(rs.next());
    stat.execute("DELETE FROM TEST");
    for (int i = 0; i < 3; i++) {
      prep.setInt(1, i);
      prep.setCharacterStream(2, new StringReader(getString(i)), -1);
      prep.addBatch();
    }
    prep.executeBatch();
    rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID");
    for (int i = 0; i < 3; i++) {
      assertTrue(rs.next());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.