예제 #1
0
 public void insertindb() {
   java.sql.Connection con = null;
   try {
     con = L2DatabaseFactory.getInstance().getConnection();
     PreparedStatement statement =
         con.prepareStatement(
             "INSERT INTO comments (serverId, comment_id,comment_ownerid,comment_date,comment_post_id,comment_topic_id,comment_forum_id,comment_txt) values (?,?,?,?,?,?,?,?)");
     statement.setInt(1, _sqlDPId);
     statement.setInt(2, _commentId);
     statement.setInt(3, _commentOwnerId);
     statement.setLong(4, _commentDate);
     statement.setInt(5, _commentPostId);
     statement.setInt(6, _commentTopicId);
     statement.setInt(7, _commentForumId);
     statement.setString(8, _commentTxt);
     statement.execute();
     statement.close();
   } catch (Exception e) {
     _log.warning("error while saving new Post to db " + e);
   } finally {
     try {
       con.close();
     } catch (Exception e) {
     }
   }
 }
예제 #2
0
 public void deleteme() {
   java.sql.Connection con = null;
   try {
     con = L2DatabaseFactory.getInstance().getConnection();
     PreparedStatement statement =
         con.prepareStatement(
             "DELETE FROM comments WHERE serverId=? AND comment_forum_id=? AND comment_topic_id=? AND comment_Post_id=? AND comment_id=?");
     statement.setInt(1, _sqlDPId);
     statement.setInt(2, _commentForumId);
     statement.setInt(3, _commentTopicId);
     statement.setInt(4, _commentPostId);
     statement.setInt(5, _commentId);
     statement.execute();
     statement.close();
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     try {
       con.close();
     } catch (Exception e) {
     }
   }
 }