Beispiel #1
0
 /**
  * ����
  *
  * @param conn
  * @param article
  * @return result count
  */
 public int modify(Connection conn, Article article) {
   String query =
       "update okboard set writer=?, subject=?, content=?, \"password\"=old_password(?), email=?, homepage=?, wtime=SYSTIMESTAMP, ip=?, html=?, ccl_id=? where seq=?";
   PreparedStatement pstmt = null;
   int result = 0;
   try {
     pstmt = conn.prepareStatement(query);
     pstmt.setString(1, article.getWriter());
     pstmt.setString(2, article.getSubject());
     pstmt.setString(3, article.getContent());
     pstmt.setString(4, article.getPassword());
     pstmt.setString(5, article.getEmail());
     pstmt.setString(6, article.getHomepage());
     pstmt.setString(7, article.getIp());
     pstmt.setString(8, article.getHtml());
     pstmt.setString(9, article.getCcl_id());
     pstmt.setInt(10, article.getSeq());
     result = pstmt.executeUpdate();
   } catch (SQLException e) {
     System.out.println("ArticleDao err:" + e.toString());
   } finally {
     dbCon.close(null, pstmt);
   }
   return result;
 }
Beispiel #2
0
  /**
   *
   *
   * <pre>
   * okboard �Է�
   * </pre>
   *
   * @param conn
   * @param article
   * @return result record count
   */
  public int write(Connection conn, Article article) {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = conn.prepareStatement(QUERY_ADD);
      int idx = 0;
      pstmt.setString(++idx, article.getBbs());
      pstmt.setInt(++idx, article.getSeq());
      pstmt.setInt(++idx, article.getRef());
      pstmt.setString(++idx, String.valueOf(article.getId()));
      pstmt.setString(++idx, article.getWriter());
      pstmt.setString(++idx, article.getSubject());
      pstmt.setString(++idx, article.getContent());
      pstmt.setString(++idx, article.getPassword());
      pstmt.setString(++idx, article.getEmail());
      pstmt.setString(++idx, article.getHomepage());
      pstmt.setString(++idx, article.getIp());
      pstmt.setString(++idx, article.getHtml());
      pstmt.setString(++idx, article.getCcl_id());
      pstmt.executeUpdate();

      if (Integer.valueOf(article.getId()) > 0) {
        new PointDao()
            .log(Integer.valueOf(article.getId()), 2, 10, String.valueOf(article.getSeq()));
      }
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      dbCon.close(null, pstmt, rs);
    }
    return article.getSeq();
  }
Beispiel #3
0
  /**
   * �亯
   *
   * @param conn
   * @param article
   * @return result count
   */
  public int reply(Connection conn, Article article) {

    String query =
        "update okboard set step = step + 1 where bbsid = ? and \"ref\" = ? and step > ?";
    int result = 0;
    PreparedStatement pstmt = null;
    try {
      pstmt = conn.prepareStatement(query);
      pstmt.setString(1, article.getBbs());
      pstmt.setInt(2, article.getRef());
      pstmt.setInt(3, article.getStep());
      pstmt.executeUpdate();
      pstmt.close();

      query =
          "insert into okboard (bbsid, seq, \"ref\", step, lev, id, writer, "
              + " subject, content, password, email, homepage, hit, memo, "
              + " wtime, ip, html, ccl_id) values (?,?,?,?,?, ?,?,?,?,old_password(?), "
              + " ?,?,0,0,SYSTIMESTAMP, ?,?,?)";
      pstmt = conn.prepareStatement(query);
      pstmt.setString(1, article.getBbs());
      pstmt.setInt(2, article.getSeq());
      pstmt.setInt(3, article.getRef());
      pstmt.setInt(4, article.getStep() + 1);
      pstmt.setInt(5, article.getLev() + 1);
      pstmt.setString(6, String.valueOf(article.getId()));
      pstmt.setString(7, article.getWriter());
      pstmt.setString(8, article.getSubject());
      pstmt.setString(9, article.getContent());
      pstmt.setString(10, article.getPassword());
      pstmt.setString(11, article.getEmail());
      pstmt.setString(12, article.getHomepage());
      pstmt.setString(13, article.getIp());
      pstmt.setString(14, article.getHtml());
      pstmt.setString(15, article.getCcl_id());
      result = pstmt.executeUpdate();
      if (Integer.valueOf(article.getId()) > 0) {
        new PointDao()
            .log(Integer.valueOf(article.getId()), 2, 10, String.valueOf(article.getSeq()));
      }
    } catch (SQLException e) {
      System.out.println(e.toString());
    } finally {
      dbCon.close(null, pstmt);
    }
    return result;
  }