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

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

?? threaddaoimpljdbc.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/jdbc/ThreadDAOImplJDBC.java,v 1.14 2004/06/03 19:14:23 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.14 $
 * $Date: 2004/06/03 19:14:23 $
 *
 * ====================================================================
 *
 * 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 com.mvnforum.db.*;
import net.myvietnam.mvncore.db.DBUtils;
import net.myvietnam.mvncore.exception.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ThreadDAOImplJDBC implements ThreadDAO {

    private static Log log = LogFactory.getLog(ThreadDAOImplJDBC.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 ThreadDAOImplJDBC() {
    }

    protected static boolean isDirty() {
        return m_dirty;
    }

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

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

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

    /*
     * Included columns: ForumID, MemberName, LastPostMemberName, ThreadTopic, ThreadBody,
     *                   ThreadVoteCount, ThreadVoteTotalStars, ThreadCreationDate, ThreadLastPostDate, ThreadType,
     *                   ThreadOption, ThreadStatus, ThreadHasPoll, ThreadViewCount, ThreadReplyCount,
     *                   ThreadIcon, ThreadDuration
     * Excluded columns: ThreadID
     */
    private void create(int forumID, String memberName, String lastPostMemberName,
                        String threadTopic, String threadBody, int threadVoteCount,
                        int threadVoteTotalStars, Timestamp threadCreationDate, Timestamp threadLastPostDate,
                        int threadType, int threadOption, int threadStatus,
                        int threadHasPoll, int threadViewCount, int threadReplyCount,
                        String threadIcon, int threadDuration)
        throws CreateException, DatabaseException, ForeignKeyNotFoundException {

        ThreadBean.validateThreadStatus(threadStatus);

        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 Thread.");
        }

        /* Here we allow memberName to be empty or null, which means
           unknown user or guest created the thread. */
        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 '' */

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("INSERT INTO " + TABLE_NAME + " (ForumID, MemberName, LastPostMemberName, ThreadTopic, ThreadBody, ThreadVoteCount, ThreadVoteTotalStars, ThreadCreationDate, ThreadLastPostDate, ThreadType, ThreadOption, ThreadStatus, ThreadHasPoll, ThreadViewCount, ThreadReplyCount, ThreadIcon, ThreadDuration)");
        sql.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());

            statement.setInt(1, forumID);
            statement.setString(2, memberName);
            statement.setString(3, lastPostMemberName);
            statement.setString(4, threadTopic);
            if (DBUtils.getDatabaseType() == DBUtils.DATABASE_ORACLE) {
                statement.setCharacterStream(5, new StringReader(threadBody), threadBody.length());
            } else {
                statement.setString(5, threadBody);
            }
            statement.setInt(6, threadVoteCount);
            statement.setInt(7, threadVoteTotalStars);
            statement.setTimestamp(8, threadCreationDate);
            statement.setTimestamp(9, threadLastPostDate);
            statement.setInt(10, threadType);
            statement.setInt(11, threadOption);
            statement.setInt(12, threadStatus);
            statement.setInt(13, threadHasPoll);
            statement.setInt(14, threadViewCount);
            statement.setInt(15, threadReplyCount);
            statement.setString(16, threadIcon);
            statement.setInt(17, threadDuration);

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

    public int createThread(int forumID, String memberName, String lastPostMemberName,
                        String threadTopic, String threadBody, int threadVoteCount,
                        int threadVoteTotalStars, Timestamp threadCreationDate, Timestamp threadLastPostDate,
                        int threadType, int threadOption, int threadStatus,
                        int threadHasPoll, int threadViewCount, int threadReplyCount,
                        String threadIcon, int threadDuration)
                        throws ObjectNotFoundException, CreateException, DatabaseException, ForeignKeyNotFoundException {

        create(forumID, memberName, lastPostMemberName, threadTopic, threadBody, threadVoteCount, threadVoteTotalStars, threadCreationDate, threadLastPostDate, threadType, threadOption, threadStatus, threadHasPoll, threadViewCount, threadReplyCount, threadIcon, threadDuration);
        int threadID = 0;
        try {
            threadID = findThreadID(forumID, memberName, threadCreationDate);
        } catch (ObjectNotFoundException ex) {
            // Hack the Oracle 9i problem
            Timestamp roundTimestamp = new Timestamp((threadCreationDate.getTime()/1000)*1000);
            threadID = findThreadID(forumID, memberName, roundTimestamp);
        }
        return threadID;
    }

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

        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);
            if (statement.executeUpdate() != 1) {
                throw new ObjectNotFoundException("Cannot delete a row in table Thread where primary key = (" + threadID + ").");
            }
            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in ThreadDAOImplJDBC.delete.");
        } 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 ThreadDAOImplJDBC.delete_inForum.");
        } finally {
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    /*
     * Included columns: ThreadTopic, ThreadBody, ThreadIcon
     * Excluded columns: ThreadID, ForumID, MemberName, LastPostMemberName, ThreadVoteCount,
     *                   ThreadVoteTotalStars, ThreadCreationDate, ThreadLastPostDate, ThreadType, ThreadOption,
     *                   ThreadStatus, ThreadHasPoll, ThreadViewCount, ThreadReplyCount,
     *                   ThreadDuration

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品视频一区二区三区不卡| 亚洲综合在线视频| 欧美在线一区二区三区| av在线播放一区二区三区| 国产黄色精品网站| 国产福利不卡视频| 日本精品一区二区三区四区的功能| 免费观看久久久4p| 老司机免费视频一区二区| 精品国产1区2区3区| 精品第一国产综合精品aⅴ| 精品av综合导航| 欧美激情在线观看视频免费| 国产欧美日韩综合| 成人免费视频在线观看| 亚洲精品免费电影| 一区二区三区四区乱视频| 亚洲一区欧美一区| 日日嗨av一区二区三区四区| 麻豆视频观看网址久久| 国产美女在线精品| 色综合天天视频在线观看| 欧美亚洲综合网| 欧美一级爆毛片| 久久久久99精品国产片| 亚洲三级免费电影| 日本一区中文字幕| 国产不卡在线视频| 欧美日韩综合一区| 久久免费美女视频| 亚洲在线免费播放| 九色|91porny| 亚洲精品视频自拍| 日本vs亚洲vs韩国一区三区二区| 精品一区二区日韩| 91麻豆成人久久精品二区三区| 成人久久18免费网站麻豆| 精品一区二区三区久久| 国产精品久久久久久久久动漫 | 亚洲国产精品99久久久久久久久| 国产精品日产欧美久久久久| 亚洲mv在线观看| 国产乱对白刺激视频不卡| 欧美中文字幕一区二区三区亚洲 | 精品一区中文字幕| 色av一区二区| 久久精品日韩一区二区三区| 午夜电影久久久| a4yy欧美一区二区三区| 欧美成人猛片aaaaaaa| 亚洲免费av在线| 精品粉嫩超白一线天av| 亚洲一二三四在线观看| 国产91色综合久久免费分享| 欧美一区二区三区白人| 一区二区三区.www| 国产成人亚洲综合色影视| 91精品免费观看| 成人深夜福利app| 国产乱理伦片在线观看夜一区| 91 com成人网| 亚洲国产一区二区a毛片| 成人久久18免费网站麻豆 | 欧美亚日韩国产aⅴ精品中极品| 久久日韩粉嫩一区二区三区| 视频一区视频二区在线观看| 91美女在线看| 综合在线观看色| hitomi一区二区三区精品| 久久影音资源网| 麻豆国产91在线播放| 91精品国产一区二区三区| 香蕉久久一区二区不卡无毒影院| ...中文天堂在线一区| 不卡的av电影在线观看| 国产精品情趣视频| 粉嫩绯色av一区二区在线观看| 久久久久久久久久久久久夜| 精彩视频一区二区| 久久久久久久久一| 欧美亚洲国产怡红院影院| 欧美性猛交xxxxxxxx| 亚洲午夜激情网站| 欧美日韩二区三区| 日韩不卡手机在线v区| 欧美一区二区三区不卡| 国产最新精品精品你懂的| 久久久午夜精品理论片中文字幕| 国内精品在线播放| 国产精品日韩成人| 欧美性色欧美a在线播放| 亚洲高清中文字幕| 日韩欧美自拍偷拍| 国产一区二区三区蝌蚪| 中文字幕第一页久久| 一本久久精品一区二区 | 三级在线观看一区二区| 亚洲综合久久av| 欧美精品一级二级| 国内精品国产成人国产三级粉色| 国产拍欧美日韩视频二区| 99re热这里只有精品免费视频| 亚洲天堂免费在线观看视频| 欧美午夜理伦三级在线观看| 免费在线观看视频一区| 久久这里只有精品6| 国产精品1区2区| 亚洲伦理在线免费看| 91精品午夜视频| 成人免费视频网站在线观看| 亚洲国产aⅴ天堂久久| 久久久精品一品道一区| 在线观看91视频| 国产一区中文字幕| 亚洲国产毛片aaaaa无费看| 精品久久99ma| 欧美在线免费播放| 国产激情一区二区三区桃花岛亚洲| 最近日韩中文字幕| 337p日本欧洲亚洲大胆精品 | 日韩你懂的电影在线观看| 亚洲欧洲另类国产综合| 欧美日本在线视频| 成人黄色在线网站| 美腿丝袜在线亚洲一区| 亚洲精选视频在线| 久久久久久黄色| 欧美电影影音先锋| 国产不卡免费视频| 精品日韩一区二区三区 | 日本丶国产丶欧美色综合| 全国精品久久少妇| 亚洲中国最大av网站| 国产日韩高清在线| 精品国产一区二区三区忘忧草| 在线亚洲一区二区| 懂色一区二区三区免费观看| 另类小说视频一区二区| 亚洲午夜羞羞片| 国产精品久久99| 不卡一区二区三区四区| 亚洲欧美日韩一区二区三区在线观看| 欧美调教femdomvk| 色综合久久综合网欧美综合网| 亚洲香肠在线观看| 国产精品每日更新在线播放网址| 日韩女优av电影在线观看| 丝袜诱惑亚洲看片| 亚洲五码中文字幕| 一区二区三区四区亚洲| 久久亚洲二区三区| 26uuu亚洲| 久久夜色精品一区| 日韩欧美你懂的| 日韩欧美国产一区在线观看| 欧美在线视频你懂得| 高清不卡一区二区| 成人动漫在线一区| 成人app软件下载大全免费| 丰满少妇久久久久久久| 懂色av一区二区三区免费观看| 国产精品性做久久久久久| 韩国在线一区二区| 国产精品99久久久久久久vr | 久久精品国产99| 视频一区视频二区中文| 日本伊人色综合网| 黄页网站大全一区二区| 国产一区二区视频在线播放| 国产精品亚洲视频| jizz一区二区| 精品视频在线免费看| 91.麻豆视频| 久久久美女毛片| 成人免费在线视频| 欧美日韩国产系列| 欧美电影免费观看高清完整版在线观看| 欧美一区二区视频网站| 久久久不卡网国产精品二区| 国产精品理伦片| 香蕉加勒比综合久久| 另类调教123区| 成人性生交大片免费看在线播放| 91老司机福利 在线| 日韩天堂在线观看| 欧美日韩免费一区二区三区视频| 日韩一区二区在线看| 欧美国产亚洲另类动漫| 亚洲制服丝袜av| 国产精品一二三四五| 欧美综合视频在线观看| 久久综合资源网| 一区二区免费在线播放| 久久se精品一区二区| 色综合一个色综合亚洲| 91精品国产欧美一区二区| 国产精品欧美一级免费| 肉肉av福利一精品导航| 粗大黑人巨茎大战欧美成人| 69堂精品视频|