public Comment addComment(int messageId, Comment comment) { String query = "insert into comment (\"commentMessage\", author, created, \"messageId\") values('" + comment.getCommentMessage() + "', '" + comment.getAuthor() + "', '" + comment.getCreated() + "', " + messageId + ")"; db.addData(query); return comment; }
public Comment updateComment(int messageId, Comment comment) { String query = "update comment set \"commentMessage\" = '" + comment.getCommentMessage() + "', author = '" + comment.getAuthor() + "', created = '" + comment.getCreated() + "', \"messageId\" = '" + messageId + "' where id = '" + comment.getId() + "'"; db.addData(query); return comment; }
public Comment removeComment(int commentId, Comment comment) { String query = "delete from comment where id = '" + commentId + "'"; db.addData(query); return comment; }