Package java.sql

Examples of java.sql.PreparedStatement.executeBatch()


          insertPropertiesStatement.execute();
        }
      }

      if (cnxSupportsBatchUpdates) {
        insertPropertiesStatement.executeBatch();
      }

      insertPropertiesStatement.close();
    }
  }
View Full Code Here


          eventId);
      tp = tp.getCause();
    }

    if (cnxSupportsBatchUpdates) {
      exceptionStatement.executeBatch();
    }
    exceptionStatement.close();
  }
}
View Full Code Here

            statement.setString(2, permissions.get(i));
            statement.addBatch();
            includedPerms.add(permissions.get(i));
          }
        }
        statement.executeBatch();
      }
    } catch (SQLException | IOException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

          continue;
        }
        statement.setString(2, group);
        statement.addBatch();
      }
      statement.executeBatch();
    } catch (SQLException | IOException e) {
      throw new RuntimeException(e);
    }

  }
View Full Code Here

          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();
        } catch (SQLException | IOException e) {
          throw new PermissionBackendException(e);
View Full Code Here

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

          // Data type corrections

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

      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);

    } catch (SQLException | IOException e) {
      throw new RuntimeException(e);
View Full Code Here

  private void performExecution() {
    try {
      for ( Map.Entry<String,PreparedStatement> entry : getStatements().entrySet() ) {
        try {
          final PreparedStatement statement = entry.getValue();
          checkRowCounts( statement.executeBatch(), statement );
        }
        catch ( SQLException e ) {
          LOG.debugf( "SQLException escaped proxy", e );
          throw sqlExceptionHelper().convert( e, "could not perform addBatch", entry.getKey() );
        }
View Full Code Here

    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());
      assertEquals(getString(i), rs.getString(2));
    }
View Full Code Here

            ps.setInt(1, i);
            ps.setInt(2, i * 2);
            ps.addBatch();
        }

        int[] result = ps.executeBatch();
        assertEquals(5, result.length);
        for (int i = 1; i <= 5; i++) {
            assertEquals(1, result[i - 1]);
        }

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.