/** * Select the topic data from the database * * @param name the name of the topic * @return <code>null</code> if no data was found * @throws Exception */ public TopicData selectTopic(String name) throws Exception { TopicData topicData = new TopicData(name); fSelectContent.setString(1, name); ResultSet resultSet = fSelectContent.executeQuery(); try { while (resultSet.next()) { topicData.setContent(resultSet.getString(1)); return topicData; } } finally { resultSet.close(); } return null; }
public void updateTopic(TopicData topic) throws Exception { fUpdateTopicContent.setString(1, topic.getContent()); fUpdateTopicContent.setString(2, topic.getName()); fUpdateTopicContent.execute(); }
public void insertTopic(TopicData topic) throws Exception { fInsertTopic.setString(1, topic.getName()); fInsertTopic.setString(2, topic.getContent()); fInsertTopic.execute(); }