1 43 package net.jforum.dao.oracle; 44 45 import java.sql.PreparedStatement ; 46 import java.sql.ResultSet ; 47 import java.util.List ; 48 49 import net.jforum.JForumExecutionContext; 50 import net.jforum.entities.Post; 51 import net.jforum.util.preferences.SystemGlobals; 52 53 57 public class OraclePostDAO extends net.jforum.dao.generic.GenericPostDAO 58 { 59 62 protected void addNewPostText(Post post) throws Exception 63 { 64 PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("PostModel.addNewPostText")); 65 p.setInt(1, post.getId()); 66 p.setString(2, post.getSubject()); 67 p.executeUpdate(); 68 p.close(); 69 70 OracleUtils.writeBlobUTF16BinaryStream( 71 SystemGlobals.getSql("PostModel.addNewPostTextField"), 72 post.getId(), post.getText() 73 ); 74 } 75 76 79 protected void updatePostsTextTable(Post post) throws Exception 80 { 81 PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("PostModel.updatePostText")); 82 p.setString(1, post.getSubject()); 83 p.setInt(2, post.getId()); 84 85 p.executeUpdate(); 86 p.close(); 87 88 OracleUtils.writeBlobUTF16BinaryStream( 89 SystemGlobals.getSql("PostModel.addNewPostTextField"), 90 post.getId(), post.getText() 91 ); 92 } 93 94 97 protected String getPostTextFromResultSet(ResultSet rs) throws Exception 98 { 99 return OracleUtils.readBlobUTF16BinaryStream(rs, "post_text"); 100 } 101 102 105 public List selectAllByTopicByLimit(int topicId, int startFrom, int count) throws Exception 106 { 107 return super.selectAllByTopicByLimit(topicId, startFrom, startFrom + count); 108 } 109 110 113 public List selectByUserByLimit(int userId,int startFrom, int count) throws Exception 114 { 115 return super.selectByUserByLimit(userId, startFrom, startFrom + count); 116 } 117 } 118 | Popular Tags |