protected void deleteTempImages() throws Exception {
    if (_log.isDebugEnabled()) {
      _log.debug("Delete temporary images");
    }

    DB db = DBManagerUtil.getDB();

    db.runSQL(
        "delete from Image where imageId IN (SELECT articleImageId FROM "
            + "JournalArticleImage where tempImage = TRUE)");

    db.runSQL("delete from JournalArticleImage where tempImage = TRUE");
  }
  protected void migrateTable(
      DB db, Connection connection, String tableName, Object[][] columns, String sqlCreate)
      throws Exception {

    Table table = new Table(tableName, columns);

    String tempFileName = table.generateTempFile();

    db.runSQL(connection, sqlCreate);

    if (tempFileName != null) {
      table.populateTable(tempFileName, connection);
    }
  }
  protected void runSQL(String template) throws IOException, SQLException {
    DB db = DBFactoryUtil.getDB();

    db.runSQL(template);
  }
  protected void runSQL(String[] sqls) throws Exception {
    DB db = DBFactoryUtil.getDB();

    db.runSQL(sqls);
  }
  protected void executeDB(String sql) throws Exception {
    DB db = DBManagerUtil.getDB();

    db.runSQL(sql);
  }
  public void runSQL(String[] templates) throws IOException, SQLException {
    DB db = DBFactoryUtil.getDB();

    db.runSQL(templates);
  }
  private static void _updateCompanyKey() throws Exception {
    DB db = DBFactoryUtil.getDB();

    db.runSQL("update Company set key_ = null");
  }
  private static void _deleteTempImages() throws Exception {
    DB db = DBFactoryUtil.getDB();

    db.runSQL(_DELETE_TEMP_IMAGES_1);
    db.runSQL(_DELETE_TEMP_IMAGES_2);
  }