亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲视频1区2区| 视频一区在线视频| 91精品综合久久久久久| 精品写真视频在线观看| 亚洲四区在线观看| 久久综合久久99| 欧美日韩一二区| 成人福利视频网站| 青青国产91久久久久久| 亚洲欧美日韩一区二区| 久久久亚洲午夜电影| 6080午夜不卡| 欧洲一区在线电影| 97超碰欧美中文字幕| 久久国产精品一区二区| 亚洲丰满少妇videoshd| 亚洲欧美区自拍先锋| 国产亚洲综合在线| 欧美一区二区三区免费大片 | 另类小说欧美激情| 亚洲一区中文在线| 国产精品天天摸av网| 精品成人在线观看| 日韩三级在线观看| 欧美伦理影视网| 在线观看日韩高清av| 91免费国产视频网站| 99久久久免费精品国产一区二区| 国产一区二区三区高清播放| 日本欧美肥老太交大片| 香蕉成人啪国产精品视频综合网| 一级中文字幕一区二区| 亚洲人成人一区二区在线观看| 国产亚洲精品福利| 久久精品人人做人人爽97| 精品国产乱码久久久久久夜甘婷婷 | 欧美国产欧美亚州国产日韩mv天天看完整| 欧美一激情一区二区三区| 欧美三级视频在线| 精品视频999| 欧美日韩一区二区三区四区| 欧美色国产精品| 欧美日韩激情在线| 欧美日韩夫妻久久| 欧美精品日韩综合在线| 欧美夫妻性生活| 欧美一区二区三区在线观看| 777久久久精品| 日韩一级欧美一级| 欧美xxxxxxxxx| 国产亚洲一区二区三区在线观看| 国产午夜久久久久| 亚洲欧洲国产日本综合| 成人欧美一区二区三区小说| 亚洲男人的天堂一区二区| 亚洲自拍与偷拍| 日日噜噜夜夜狠狠视频欧美人| 天堂一区二区在线| 乱中年女人伦av一区二区| 国产高清在线精品| 不卡的av在线播放| 在线视频欧美精品| 91麻豆精品国产91久久久更新时间 | 欧美二区三区的天堂| 欧美一区二区三区四区在线观看| 日韩女优电影在线观看| 久久综合九色欧美综合狠狠| 国产精品成人免费精品自在线观看| 一区二区三区欧美在线观看| 视频在线观看91| 国产精品正在播放| 一本大道久久精品懂色aⅴ| 欧美日韩亚洲国产综合| 久久免费午夜影院| 亚洲精品伦理在线| 久久电影网电视剧免费观看| 白白色亚洲国产精品| 欧美午夜不卡在线观看免费| 精品国产百合女同互慰| 亚洲男人的天堂av| 精品一区二区日韩| 色乱码一区二区三区88| 欧美成va人片在线观看| 亚洲欧洲一区二区在线播放| 日韩激情av在线| 国产成人av网站| 欧美日韩国产123区| 中文字幕免费不卡| 日韩福利电影在线观看| 成人av电影在线| 91精品国产综合久久久久| 中文字幕电影一区| 免费在线观看一区二区三区| 色综合色狠狠天天综合色| 337p日本欧洲亚洲大胆精品| 亚洲成人av福利| www.日韩大片| 26uuu精品一区二区在线观看| 亚洲综合色成人| 成人一二三区视频| 日韩精品中文字幕一区 | 夜夜夜精品看看| 国产成人丝袜美腿| 91精品一区二区三区在线观看| 国产精品欧美精品| 激情综合色播激情啊| 欧美猛男男办公室激情| 国产精品国产三级国产aⅴ入口| 久久激情五月激情| 在线播放中文一区| 亚洲图片自拍偷拍| 成人毛片视频在线观看| 欧美大片一区二区| 三级在线观看一区二区 | 欧美国产综合色视频| 美女视频黄频大全不卡视频在线播放| 99国内精品久久| 日本一区二区三区免费乱视频| 麻豆精品久久精品色综合| 国产精品伦一区| 粉嫩av一区二区三区粉嫩| 欧美大片在线观看一区二区| 日本人妖一区二区| 这里只有精品视频在线观看| 亚洲电影一区二区三区| 一本久久a久久免费精品不卡| 国产精品日韩精品欧美在线| 国产精品自拍av| 精品成人a区在线观看| 蜜桃av一区二区| 精品久久人人做人人爽| 美腿丝袜在线亚洲一区| 欧美大片日本大片免费观看| 美女网站在线免费欧美精品| 日韩午夜在线播放| 久久99精品久久久久| 日韩丝袜情趣美女图片| 久久99国产精品成人| 精品国产乱码久久久久久闺蜜| 蜜臀av性久久久久蜜臀aⅴ流畅 | 欧美三区在线视频| 亚洲一卡二卡三卡四卡无卡久久| 91黄色免费观看| 亚洲成人免费在线观看| 欧美美女网站色| 日韩电影免费一区| 日韩欧美www| 国产黄色精品网站| 国产精品视频在线看| 99免费精品视频| 18成人在线观看| 欧美丝袜丝交足nylons图片| 亚洲va欧美va人人爽| 91精品国产综合久久精品性色| 日本va欧美va精品发布| 久久午夜色播影院免费高清| 不卡一区二区在线| 一区二区在线观看视频 | 欧美一区二区视频在线观看2020| 日韩av网站免费在线| 精品久久五月天| 91丝袜美女网| 无码av免费一区二区三区试看| 日韩一二三区不卡| www.欧美日韩| 午夜精品国产更新| 国产亚洲精品精华液| 一本一道久久a久久精品| 视频在线观看国产精品| 久久久欧美精品sm网站| 99精品欧美一区二区蜜桃免费 | 久久国内精品视频| 日韩伦理电影网| 91精品国产一区二区三区蜜臀 | 国产美女视频91| 亚洲精品亚洲人成人网| 日韩一级欧美一级| 99久久久久久| 久久99精品视频| 一区二区三区在线观看网站| 日韩亚洲电影在线| 91小视频免费观看| 久久国产福利国产秒拍| 亚洲精品日日夜夜| 久久亚区不卡日本| 欧美性xxxxxxxx| 国产精品 欧美精品| 91免费国产在线| 国产综合一区二区| 亚欧色一区w666天堂| 国产欧美日韩另类视频免费观看| 欧美少妇bbb| 9人人澡人人爽人人精品| 蜜臀av性久久久久蜜臀av麻豆| 亚洲欧美乱综合| 欧美高清在线一区| 精品久久久久久久久久久久久久久久久| 91热门视频在线观看| 国产精品888| 麻豆一区二区三区|