Esempio n. 1
0
  public List<CheckInfo> get() {
    List<CheckInfo> list = new ArrayList<CheckInfo>();
    Statement stmt = null;
    String sql = "select * from spider_check where cType <> 5 order by sid ";
    ResultSet rs = null;
    try {
      stmt = daoHelp.getConnection().createStatement();
      rs = stmt.executeQuery(sql);
      while (rs.next()) {
        CheckInfo checkInfo = new CheckInfo();
        checkInfo.setSid(rs.getString(1));
        checkInfo.setPid(rs.getString(2));
        checkInfo.setField(rs.getString(3));
        checkInfo.setUrl(rs.getString(4));
        checkInfo.setCType(rs.getInt(5));
        checkInfo.setSite(rs.getString(6));
        checkInfo.setSType(rs.getString(7));
        checkInfo.setContent(rs.getString(8));
        list.add(checkInfo);
      }
      daoHelp.safeClose(rs);
      daoHelp.safeClose(stmt);
    } catch (SQLException e) {
      log.error("SQLException -> ", e);
      daoHelp.safeClose(rs);
      daoHelp.safeClose(stmt);
    } finally {
      daoHelp.safeClose(rs);
      daoHelp.safeClose(stmt);
    }

    return list;
  }
Esempio n. 2
0
 public void create(CheckInfo info) {
   StringBuffer sql = new StringBuffer();
   sql.append("insert into spider_check (sid, pid, field, url, cType, site, sType, content");
   sql.append(" ) values ( ");
   sql.append(daoHelp.format(info.getSid()) + ",");
   sql.append(daoHelp.format(info.getPid()) + ",");
   sql.append(daoHelp.format(info.getField()) + ",");
   sql.append(daoHelp.format(info.getUrl()) + ",");
   sql.append(daoHelp.format(info.getCType()) + ",");
   sql.append(daoHelp.format(info.getSite()) + ",");
   sql.append(daoHelp.format(info.getSType()) + ",");
   sql.append(daoHelp.format(info.getContent()) + ")");
   daoHelp.execSql(sql.toString());
 }