Пример #1
0
  public static void delete(int newsPollId) throws FtdException {
    String sql = "delete from news_poll where news_id = ?";
    DBClient dbClient = SysMgr.getInstance().getDbClient();

    try {
      dbClient.executeUpdate(sql, newsPollId);
    } catch (SQLException e) {
      throw new FtdException(e, "db.sql.error");
    }
  }
Пример #2
0
  public static void insert(NewsPoll np) throws FtdException {
    String sql =
        "insert into news_poll(news_title,poll_img_url,article_id, is_active) values(?,?,?,?)";

    DBClient dbClient = SysMgr.getInstance().getDbClient();

    try {
      dbClient.executeUpdate(
          sql, np.getNewsTitle(), np.getPollImgUrl(), np.getArticleId(), np.getActive());
    } catch (SQLException e) {
      throw new FtdException(e, "db.sql.error");
    }
  }
Пример #3
0
  public static void update(NewsPoll np) throws FtdException {
    String sql =
        "update news_poll set news_title=?, poll_img_url=?,article_id=?,is_active=? where news_id=?";
    DBClient dbClient = SysMgr.getInstance().getDbClient();

    try {
      dbClient.executeUpdate(
          sql,
          np.getNewsTitle(),
          np.getPollImgUrl(),
          np.getArticleId(),
          np.getActive(),
          np.getNewsId());
    } catch (SQLException e) {
      throw new FtdException(e, "db.sql.error");
    }
  }