亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? postdaoimpljdbc.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/jdbc/PostDAOImplJDBC.java,v 1.8 2004/03/20 19:15:04 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.8 $
 * $Date: 2004/03/20 19:15:04 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2004 by MyVietnam.net
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * All copyright notices regarding mvnForum MUST remain intact
 * in the scripts and in the outputted HTML.
 * The "powered by" text/logo with a link back to
 * http://www.mvnForum.com and http://www.MyVietnam.net in the
 * footer of the pages MUST remain visible when the pages
 * are viewed on the internet or intranet.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Support can be obtained from support forums at:
 * http://www.mvnForum.com/mvnforum/index
 *
 * Correspondence and Marketing Questions can be sent to:
 * info@MyVietnam.net
 *
 * @author: Minh Nguyen  minhnn@MyVietnam.net
 * @author: Mai  Nguyen  mai.nh@MyVietnam.net
 */
package com.mvnforum.db.jdbc;

import java.io.StringReader;
import java.sql.*;
import java.util.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.mvnforum.db.*;
import net.myvietnam.mvncore.db.DBUtils;
import net.myvietnam.mvncore.exception.*;

public class PostDAOImplJDBC implements PostDAO {

    private static Log log = LogFactory.getLog(PostDAOImplJDBC.class);

    // this variable will support caching if cache for this class is needed
    private static boolean m_dirty = true;

    // Prevent instantiation from classes other than derived classes
    public PostDAOImplJDBC() {
    }

    protected static boolean isDirty() {
        return m_dirty;
    }

    protected static void setDirty(boolean dirty) {
        m_dirty = dirty;
    }

    public void findByPrimaryKey(int postID)
        throws ObjectNotFoundException, DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT PostID");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE PostID = ?");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, postID);
            resultSet = statement.executeQuery();
            if (!resultSet.next()) {
                throw new ObjectNotFoundException("Cannot find the primary key (" + postID + ") in table 'Post'.");
            }
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in PostDAOImplJDBC.findByPrimaryKey.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    /*
     * Included columns: ParentPostID, ForumID, ThreadID, MemberID, MemberName,
     *                   LastEditMemberName, PostTopic, PostBody, PostCreationDate, PostLastEditDate,
     *                   PostCreationIP, PostLastEditIP, PostEditCount, PostFormatOption, PostOption,
     *                   PostStatus, PostIcon, PostAttachCount
     * Excluded columns: PostID
     */
    public void create(int parentPostID, int forumID, int threadID,
                        int memberID, String memberName, String lastEditMemberName,
                        String postTopic, String postBody, Timestamp postCreationDate,
                        Timestamp postLastEditDate, String postCreationIP, String postLastEditIP,
                        int postEditCount, int postFormatOption, int postOption,
                        int postStatus, String postIcon, int postAttachCount)
        throws CreateException, DatabaseException, ForeignKeyNotFoundException {

        try {
            // @todo: modify the parameter list as needed
            // You may have to regenerate this method if the needed columns dont have attribute 'include'
            DAOFactory.getForumDAO().findByPrimaryKey(forumID);
        } catch(ObjectNotFoundException e) {
            throw new ForeignKeyNotFoundException("Foreign key refers to table 'Forum' does not exist. Cannot create new Post.");
        }

        //allow anonymous/guests to post
        if (memberID!=0) {
            try {
                // @todo: modify the parameter list as needed
                // You may have to regenerate this method if the needed columns dont have attribute 'include'
                DAOFactory.getMemberDAO().findByPrimaryKey(memberID);
            } catch(ObjectNotFoundException e) {
                throw new ForeignKeyNotFoundException("Foreign key refers to table 'Member' does not exist. Cannot create new Post.");
            }
        }

        try {
            // @todo: modify the parameter list as needed
            // You may have to regenerate this method if the needed columns dont have attribute 'include'
            DAOFactory.getThreadDAO().findByPrimaryKey(threadID);
        } catch(ObjectNotFoundException e) {
            throw new ForeignKeyNotFoundException("Foreign key refers to table 'Thread' does not exist. Cannot create new Post.");
        }

        //We allow anonymous/guests to send posts too (if admin allows them to).
        if ((memberName!=null) && (memberName.length()>0)) {
            try {
                // @todo: modify the parameter list as needed
                // You may have to regenerate this method if the needed columns dont have attribute 'include'
                DAOFactory.getMemberDAO().findByAlternateKey_MemberName(memberName);
            } catch(ObjectNotFoundException e) {
                throw new ForeignKeyNotFoundException("Foreign key refers to table 'Member' does not exist. Cannot create new Post.");
            }
        } else memberName=""; /* This is needed, otherwise we will get 'null' in the
                                 sql query, instead of '' */

        try {
            // @todo: modify the parameter list as needed
            // You may have to regenerate this method if the needed columns dont have attribute 'include'
            if (parentPostID != 0) {
                findByPrimaryKey(parentPostID);
            }
        } catch(ObjectNotFoundException e) {
            throw new ForeignKeyNotFoundException("Foreign key refers to table 'Post' does not exist. Cannot create new Post.");
        }

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("INSERT INTO " + TABLE_NAME + " (ParentPostID, ForumID, ThreadID, MemberID, MemberName, LastEditMemberName, PostTopic, PostBody, PostCreationDate, PostLastEditDate, PostCreationIP, PostLastEditIP, PostEditCount, PostFormatOption, PostOption, PostStatus, PostIcon, PostAttachCount)");
        sql.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());

            statement.setInt(1, parentPostID);
            statement.setInt(2, forumID);
            statement.setInt(3, threadID);
            statement.setInt(4, memberID);
            statement.setString(5, memberName);
            statement.setString(6, lastEditMemberName);
            statement.setString(7, postTopic);
            if (DBUtils.getDatabaseType() == DBUtils.DATABASE_ORACLE) {
                statement.setCharacterStream(8, new StringReader(postBody), postBody.length());
            } else {
                statement.setString(8, postBody);
            }
            statement.setTimestamp(9, postCreationDate);
            statement.setTimestamp(10, postLastEditDate);
            statement.setString(11, postCreationIP);
            statement.setString(12, postLastEditIP);
            statement.setInt(13, postEditCount);
            statement.setInt(14, postFormatOption);
            statement.setInt(15, postOption);
            statement.setInt(16, postStatus);
            statement.setString(17, postIcon);
            statement.setInt(18, postAttachCount);

            if (statement.executeUpdate() != 1) {
                throw new CreateException("Error adding a row into table 'Post'.");
            }
            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in PostDAOImplJDBC.create.");
        } finally {
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public int createPost(int parentPostID, int forumID, int threadID,
                       int memberID, String memberName, String lastEditMemberName,
                       String postTopic, String postBody, Timestamp postCreationDate,
                       Timestamp postLastEditDate, String postCreationIP, String postLastEditIP,
                       int postEditCount, int postFormatOption, int postOption,
                       int postStatus, String postIcon, int postAttachCount)
        throws CreateException, DatabaseException, ForeignKeyNotFoundException {

        create(
            parentPostID, forumID, threadID, memberID, memberName, lastEditMemberName,
            postTopic, postBody, postCreationDate, postLastEditDate,
            postCreationIP, postLastEditIP, postEditCount, postFormatOption,
            postOption, postStatus, postIcon, postAttachCount);

        int postID = 0;
        try {
            postID = findPostID(forumID, memberName, postCreationDate);
        } catch (ObjectNotFoundException ex) {
            // Hack the Oracle 9i problem
            Timestamp roundTimestamp = new Timestamp((postCreationDate.getTime()/1000)*1000);
            try {
               postID = findPostID(forumID, memberName, roundTimestamp);
            } catch (ObjectNotFoundException e) {
               throw new CreateException("Cannot find the PostID in table Post.");
            }
        }
        return postID;
    }

    public void delete(int postID)
        throws DatabaseException, ObjectNotFoundException {

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("DELETE FROM " + TABLE_NAME);
        sql.append(" WHERE PostID = ?");

        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, postID);
            if (statement.executeUpdate() != 1) {
                throw new ObjectNotFoundException("Cannot delete a row in table Post where PostID = (" + postID + ").");
            }
            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in PostDAOImplJDBC.delete.");
        } finally {
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public void delete_inThread(int threadID)
        throws DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("DELETE FROM " + TABLE_NAME);
        sql.append(" WHERE ThreadID = ?");

        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, threadID);

            statement.executeUpdate();

            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in PostDAOImplJDBC.delete_inThread.");
        } finally {
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public void delete_inForum(int forumID)
        throws DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("DELETE FROM " + TABLE_NAME);
        sql.append(" WHERE ForumID = ?");

        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, forumID);
            statement.executeUpdate();
            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in PostDAOImplJDBC.delete_inForum.");
        } finally {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久久久久久久久久久包黑料| 7777精品伊人久久久大香线蕉完整版| 亚洲一二三四在线| 精品奇米国产一区二区三区| 97久久精品人人做人人爽50路| 日韩精品免费专区| 国产精品不卡在线观看| 欧美一区二区三区影视| 日本道在线观看一区二区| 国产综合色视频| 午夜电影一区二区| 夜夜操天天操亚洲| 国产精品无人区| 精品成人佐山爱一区二区| 欧美裸体一区二区三区| 91在线无精精品入口| 国产伦精品一区二区三区在线观看| 亚洲综合区在线| 国产精品久久久久桃色tv| 亚洲精品一区二区三区在线观看| 欧美日韩高清一区二区| 色婷婷国产精品久久包臀| av男人天堂一区| 成人精品鲁一区一区二区| 加勒比av一区二区| 日本大胆欧美人术艺术动态| 亚洲一区二区免费视频| 亚洲人成在线播放网站岛国| 国产欧美日韩在线看| 精品国产123| 精品国产91乱码一区二区三区| 日韩欧美一卡二卡| 欧美一二三四区在线| 在线综合视频播放| 欧美一区二区二区| 日韩欧美二区三区| 精品欧美一区二区三区精品久久| 欧美日韩高清在线播放| 欧美精品乱码久久久久久| 欧美午夜免费电影| 欧美日韩高清影院| 日韩一区二区三区高清免费看看| 欧美高清视频不卡网| 8x8x8国产精品| 91精品久久久久久久99蜜桃 | 亚洲成人免费影院| 一区二区三区小说| 亚洲无线码一区二区三区| 午夜精品一区二区三区电影天堂| 亚洲成人av中文| 日韩高清在线电影| 国精产品一区一区三区mba桃花 | 99久久精品免费| 91视频com| 欧美三级欧美一级| 欧美一区二区三区爱爱| 久久亚洲一区二区三区明星换脸 | 婷婷中文字幕一区三区| 日韩精品国产精品| 国产乱淫av一区二区三区| 国产精品99久久久久久久vr| 99久久伊人精品| 欧美伊人久久大香线蕉综合69| 3atv一区二区三区| 久久嫩草精品久久久精品| 国产精品久久久久aaaa樱花| 一区二区三区四区乱视频| 石原莉奈一区二区三区在线观看| 久久国产婷婷国产香蕉| 成人激情动漫在线观看| 欧美综合欧美视频| 欧美不卡视频一区| 亚洲视频综合在线| 日本视频一区二区三区| 国产精品88888| 欧美日韩一级片网站| 精品福利一区二区三区免费视频| 国产精品久久久久久久久久久免费看| 亚洲一区二区三区四区不卡| 麻豆91在线播放免费| 成人av资源站| 6080yy午夜一二三区久久| 中文字幕欧美日本乱码一线二线| 一区二区三区四区精品在线视频| 麻豆精品一区二区综合av| av中文字幕在线不卡| 欧美日韩在线精品一区二区三区激情| 精品国产第一区二区三区观看体验| 亚洲欧洲国产专区| 麻豆成人久久精品二区三区红| 菠萝蜜视频在线观看一区| 91.xcao| 日韩伦理免费电影| 精东粉嫩av免费一区二区三区| 日本道色综合久久| 久久久亚洲精品一区二区三区| 亚洲一区欧美一区| 成人黄页毛片网站| 日韩欧美卡一卡二| 亚洲国产日日夜夜| 成人app网站| 久久综合五月天婷婷伊人| 亚洲国产wwwccc36天堂| 99r国产精品| 久久久99久久| 日韩电影在线一区二区三区| 91高清视频免费看| 欧美激情艳妇裸体舞| 久久精品国产99国产精品| 欧美日韩在线亚洲一区蜜芽| 亚洲欧美日韩成人高清在线一区| 国内精品国产成人| 日韩一二在线观看| 亚洲大片免费看| 欧洲亚洲国产日韩| 自拍偷拍亚洲欧美日韩| 国产乱码精品1区2区3区| 日韩欧美中文字幕公布| 亚洲va中文字幕| 色天天综合久久久久综合片| 亚洲国产高清在线| 国产高清亚洲一区| 久久久噜噜噜久久中文字幕色伊伊 | 国产成人免费av在线| 精品国产髙清在线看国产毛片| 日韩成人伦理电影在线观看| 欧美午夜电影在线播放| 一区二区三区在线免费播放| 国产盗摄视频一区二区三区| 在线视频国内一区二区| 亚洲免费av高清| 欧美亚洲国产一区二区三区va| 午夜精品视频一区| 欧美xxxx老人做受| 不卡的电影网站| 污片在线观看一区二区| 久久久91精品国产一区二区精品 | 欧美日韩高清影院| 亚洲三级久久久| 91免费版在线| 亚洲蜜臀av乱码久久精品| 色综合婷婷久久| 一区二区三区四区五区视频在线观看| 91美女视频网站| 亚洲午夜视频在线观看| 欧美无砖专区一中文字| 亚洲h动漫在线| 51久久夜色精品国产麻豆| 美女视频一区二区三区| 精品国产网站在线观看| 国产99久久久国产精品潘金| 国产精品麻豆欧美日韩ww| 91小视频在线观看| 亚洲风情在线资源站| 欧美一卡二卡三卡四卡| 国产乱色国产精品免费视频| 国产精品免费久久| 色嗨嗨av一区二区三区| 亚洲成人动漫在线免费观看| 日韩视频免费观看高清完整版在线观看| 男女视频一区二区| 久久久777精品电影网影网 | 激情国产一区二区| 国产蜜臀av在线一区二区三区| 91亚洲国产成人精品一区二三 | 国产精品女主播av| 欧美色视频在线| 久久er99精品| 最好看的中文字幕久久| 欧美日韩国产综合视频在线观看| 麻豆久久久久久久| 亚洲婷婷综合久久一本伊一区| 欧美人成免费网站| 国产精品99久久不卡二区| 亚洲综合一区二区| 精品国产3级a| 欧美午夜精品一区二区蜜桃| 国内不卡的二区三区中文字幕 | 欧美三级欧美一级| 国产电影一区二区三区| 亚洲综合一区二区三区| wwww国产精品欧美| 欧美性高清videossexo| 激情六月婷婷综合| 亚洲国产日韩综合久久精品| 久久久久久久久久久久久久久99 | 成人午夜看片网址| 日韩成人午夜电影| 亚洲女性喷水在线观看一区| 日韩一区二区免费视频| 色拍拍在线精品视频8848| 国产曰批免费观看久久久| 亚洲国产美女搞黄色| 国产亚洲污的网站| 欧美群妇大交群的观看方式| 成人av资源在线| 国产一区二区三区四区五区入口| 亚洲图片有声小说| 国产精品福利一区二区| 精品99一区二区|