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

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

?? groupforumdaoimpljdbc.java

?? java servlet著名論壇源代碼
?? JAVA
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/jdbc/GroupForumDAOImplJDBC.java,v 1.2 2004/01/18 19:13:11 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.2 $
 * $Date: 2004/01/18 19:13:11 $
 *
 * ====================================================================
 *
 * 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.sql.*;
import java.util.ArrayList;
import java.util.Collection;

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 GroupForumDAOImplJDBC implements GroupForumDAO {

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

    protected static boolean isDirty() {
        return m_dirty;
    }

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

    public void findByPrimaryKey(int groupID, int forumID, int permission)
        throws ObjectNotFoundException, DatabaseException {

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

    /*
     * Included columns: GroupID, ForumID, Permission
     * Excluded columns:
     */
    public void create(int groupID, int forumID, int permission)
        throws CreateException, DatabaseException, DuplicateKeyException, ForeignKeyNotFoundException {

        // @todo: comment this try-catch block if the needed columns dont have attribute 'include'
        // If this is the case, then it is highly recommended that you regenerate this method with the attribute 'include' turned on
        // However, if primary key is a auto_increament column, then you can safely delete this block
        try {
            //Check if primary key already exists
            findByPrimaryKey(groupID, forumID, permission);
            //If so, then we have to throw an exception
            throw new DuplicateKeyException("Primary key already exists. Cannot create new GroupForum with the same <GroupID, ForumID, Permission> (" + groupID + ", " + forumID + ", " + permission + ").");
        } catch(ObjectNotFoundException e) {
            //Otherwise we can go ahead
        }

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

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

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("INSERT INTO " + TABLE_NAME + " (GroupID, ForumID, Permission)");
        sql.append(" VALUES (?, ?, ?)");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());

            statement.setInt(1, groupID);
            statement.setInt(2, forumID);
            statement.setInt(3, permission);

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

    public void delete(int groupID, int forumID, int permission)
        throws DatabaseException, ObjectNotFoundException {

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

        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, groupID);
            statement.setInt(2, forumID);
            statement.setInt(3, permission);
            if (statement.executeUpdate() != 1) {
                throw new ObjectNotFoundException("Cannot delete a row in table GroupForum where primary key = (" + groupID + ", " + forumID + ", " + permission + ").");
            }
            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in GroupForumDAOImplJDBC.delete.");
        } finally {
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public void delete_inGroup(int groupID)
        throws DatabaseException {

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

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

            statement.executeUpdate();
            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in GroupForumDAOImplJDBC.delete_inGroup.");
        } 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 GroupForumDAOImplJDBC.delete_inForum.");
        } finally {
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }


/************************************************
 * Customized methods come below
 ************************************************/

    /*
     * Included columns: Permission
     * Excluded columns: GroupID, ForumID
     */
    public Collection getBeans_inGroupForum(int groupID, int forumID)
        throws DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        Collection retValue = new ArrayList();
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT Permission");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE GroupID = ? AND ForumID = ?"); // @todo: uncomment as needed
        //sql.append(" ORDER BY ColumnName ASC|DESC "); // @todo: uncomment as needed
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, groupID);
            statement.setInt(2, forumID);

            resultSet = statement.executeQuery();
            while (resultSet.next()) {
                GroupForumBean bean = new GroupForumBean();
                bean.setGroupID(groupID);
                bean.setForumID(forumID);
                bean.setPermission(resultSet.getInt("Permission"));
                retValue.add(bean);
            }
            return retValue;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in GroupForumDAOImplJDBC.getBeans.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    /*
     * Included columns: GroupID, ForumID, Permission
     * Excluded columns:
     */
    public Collection getBeans_inForum(int forumID)
        throws DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        Collection retValue = new ArrayList();
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT GroupID, ForumID, Permission");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE ForumID = ? ");
        sql.append(" ORDER BY GroupID ");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, forumID);

            resultSet = statement.executeQuery();
            while (resultSet.next()) {
                GroupForumBean bean = new GroupForumBean();
                bean.setGroupID(resultSet.getInt("GroupID"));
                bean.setForumID(resultSet.getInt("ForumID"));
                bean.setPermission(resultSet.getInt("Permission"));
                retValue.add(bean);
            }
            return retValue;
        } catch (SQLException sqle) {
            sqle.printStackTrace();
            throw new DatabaseException("Error executing SQL in GroupForumDAOImplJDBC.getBeans_inForum.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    /*
     * Included columns: GroupID, ForumID, Permission
     * Excluded columns:
     */
    public Collection getBeans_inGroup(int groupID)
        throws DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        Collection retValue = new ArrayList();
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT GroupID, ForumID, Permission");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE GroupID = ? ");
        sql.append(" ORDER BY ForumID ");

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

            resultSet = statement.executeQuery();
            while (resultSet.next()) {
                GroupForumBean bean = new GroupForumBean();
                bean.setGroupID(resultSet.getInt("GroupID"));
                bean.setForumID(resultSet.getInt("ForumID"));
                bean.setPermission(resultSet.getInt("Permission"));
                retValue.add(bean);
            }
            return retValue;
        } catch (SQLException sqle) {
            sqle.printStackTrace();
            throw new DatabaseException("Error executing SQL in GroupForumDAOImplJDBC.getBeans_inGroup.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

}// end of class GroupForumDAOImplJDBC

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女久久福利网站| 欧美xxxxx裸体时装秀| 亚洲天堂网中文字| 中文字幕国产一区| 久久久久综合网| 日韩一区二区三区免费观看| 精品国产乱码久久久久久夜甘婷婷| 欧美亚洲自拍偷拍| 欧美一级精品大片| 国产精品欧美一区喷水| 欧美不卡在线视频| 国精产品一区一区三区mba视频 | 久久精品国产精品青草| 久热成人在线视频| 成人激情动漫在线观看| 在线观看日韩电影| 精品国产不卡一区二区三区| 国产欧美日本一区二区三区| 一区二区三区免费网站| 狠狠狠色丁香婷婷综合激情| 色婷婷综合久色| 久久久久久久久久久久久夜| 亚洲猫色日本管| 精品亚洲免费视频| 欧美精品久久99久久在免费线 | 成人国产在线观看| 欧美人妇做爰xxxⅹ性高电影| 欧美大片在线观看一区| 中文字幕精品在线不卡| 久久婷婷国产综合精品青草| 亚洲高清中文字幕| 日本久久精品电影| 亚洲精品欧美专区| 97久久久精品综合88久久| 国产亚洲欧美在线| 国产精品综合网| 日韩欧美一级二级三级| 久久精品国产秦先生| 欧美一区二区三区四区在线观看| 久久亚洲一级片| 高清国产一区二区| 国产精品毛片久久久久久| 国产91高潮流白浆在线麻豆 | 亚洲蜜桃精久久久久久久| 在线亚洲精品福利网址导航| 亚洲精品乱码久久久久久日本蜜臀| 国产成人精品www牛牛影视| 久久久久久久国产精品影院| 国产成人av福利| 亚洲卡通欧美制服中文| 欧美一区日本一区韩国一区| 五月激情综合色| 久久婷婷色综合| 欧美性大战久久久| 久久99久久久久| 亚洲线精品一区二区三区八戒| 欧美一级在线免费| 国内精品久久久久影院薰衣草| av一本久道久久综合久久鬼色| 午夜电影网亚洲视频| 欧美韩国日本综合| 日韩欧美一区二区久久婷婷| 色呦呦日韩精品| 国产成人h网站| 久久99热这里只有精品| 视频一区二区中文字幕| 亚洲成a人v欧美综合天堂| |精品福利一区二区三区| 精品国产区一区| 精品国产一区a| 欧美一二三区精品| 欧美大白屁股肥臀xxxxxx| 福利一区在线观看| 国产麻豆一精品一av一免费 | 欧美成人一级视频| 欧美一区国产二区| 久久亚洲综合色一区二区三区| 日韩欧美亚洲一区二区| 精品久久久久久最新网址| 久久久久久久久久久久电影| 久久综合久久鬼色| 风间由美中文字幕在线看视频国产欧美| 日韩中文字幕区一区有砖一区| 综合久久给合久久狠狠狠97色| 国产精品色在线| 亚洲成精国产精品女| 日本中文一区二区三区| 国产精品自拍网站| 91视频91自| 久久婷婷国产综合国色天香| 综合激情成人伊人| 肉色丝袜一区二区| 国产成人午夜精品5599| 欧美性极品少妇| 久久se精品一区精品二区| 成人午夜视频在线观看| 国产风韵犹存在线视精品| 日韩—二三区免费观看av| 亚洲成人免费在线观看| 亚洲视频一区二区在线观看| 亚洲人成网站在线| 国产成人精品午夜视频免费| 精品亚洲porn| 91亚洲精华国产精华精华液| 欧美精品在线观看一区二区| 久久综合久久综合久久综合| 丝袜亚洲另类欧美| 91女神在线视频| 欧美视频在线一区二区三区| 成人小视频在线| 久久久久久亚洲综合影院红桃| 水蜜桃久久夜色精品一区的特点 | 久久se精品一区精品二区| 色哦色哦哦色天天综合| 国产精品不卡在线| 91免费版在线看| 亚洲免费观看视频| 色综合天天综合色综合av | 欧美电视剧在线看免费| 免费看日韩a级影片| 欧美tickling网站挠脚心| 激情文学综合插| 国产女人水真多18毛片18精品视频| 精品一区二区三区免费| 国产欧美日韩激情| 欧美综合欧美视频| 激情欧美日韩一区二区| 国产精品免费观看视频| 欧美影视一区二区三区| 久久99精品久久只有精品| 欧美精品一区二区高清在线观看| 成人激情综合网站| 一区二区在线免费观看| 欧美视频一区二区| 国产婷婷色一区二区三区四区| www.性欧美| 国产精品一区专区| 日韩二区三区四区| 一区二区三区在线播放| 日韩小视频在线观看专区| 色av一区二区| 99久久精品免费看| 成人免费视频播放| 国产精品1024| 国产成人丝袜美腿| 国产综合久久久久久鬼色| 日韩不卡在线观看日韩不卡视频| 国产精品高潮呻吟| 亚洲欧美一区二区不卡| 久久久精品影视| 久久久777精品电影网影网 | 91麻豆精品久久久久蜜臀 | 亚洲欧美福利一区二区| 久久久久国色av免费看影院| 精品国产免费人成电影在线观看四季| 欧美日韩在线播| 亚洲精品一区二区精华| 国产欧美1区2区3区| 国产精品久久久久桃色tv| 亚洲一区在线电影| 婷婷成人综合网| 成人综合在线观看| 自拍av一区二区三区| 亚洲一区二区不卡免费| 日本aⅴ亚洲精品中文乱码| 久久国产剧场电影| www.亚洲色图.com| 亚洲日本一区二区三区| 精品中文字幕一区二区| 免费看日韩精品| 爽爽淫人综合网网站| 一区二区三区产品免费精品久久75| 久久蜜臀精品av| 欧美一区二视频| 椎名由奈av一区二区三区| 3atv一区二区三区| 久久久久久久久久久久久久久99| ...中文天堂在线一区| 精品一二线国产| 欧美午夜精品免费| 亚洲欧洲日韩av| 处破女av一区二区| 久久久影视传媒| 六月婷婷色综合| 欧美日韩一区三区| 亚洲永久免费视频| 在线免费观看一区| 久久影视一区二区| 久久99久久久欧美国产| 在线综合亚洲欧美在线视频| 亚洲国产精品久久久久婷婷884| av中文字幕不卡| 亚洲激情综合网| 欧美三级电影在线观看| 日韩精品电影在线| 欧美一激情一区二区三区| 男女视频一区二区| 日韩精品一区二区三区视频播放 | 国产精品系列在线播放| 欧美精品一区二区三区高清aⅴ |