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

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

?? membergroupdaoimpljdbc.java

?? java servlet著名論壇源代碼
?? JAVA
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/jdbc/MemberGroupDAOImplJDBC.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 MemberGroupDAOImplJDBC implements MemberGroupDAO {

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

    protected static boolean isDirty() {
        return m_dirty;
    }

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

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

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

    /*
     * Included columns: GroupID, MemberID, MemberName, Privilege, CreationDate,
     *                   ModifiedDate
     * Excluded columns:
     */
    public void create(int groupID, String memberName,
                       int privilege, Timestamp creationDate, Timestamp modifiedDate)
         throws CreateException, DatabaseException, DuplicateKeyException, ForeignKeyNotFoundException {

        int 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().findByAlternateKey_MemberName(memberName);//redundant ???
            memberID = DAOFactory.getMemberDAO().getMemberIDFromMemberName(memberName);
        } catch(ObjectNotFoundException e) {
            throw new ForeignKeyNotFoundException("Foreign key refers to table 'Member' does not exist. Cannot create new MemberGroup.");
        }

        // @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, memberID);
            //If so, then we have to throw an exception
            throw new DuplicateKeyException("Primary key already exists. Cannot create new MemberGroup with the same <GroupID, MemberID> (" + groupID + ", " + memberID + ").");
        } 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.getGroupsDAO().findByPrimaryKey(groupID);
        } catch(ObjectNotFoundException e) {
            throw new ForeignKeyNotFoundException("Foreign key refers to table 'Groups' does not exist. Cannot create new MemberGroup.");
        }

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

            statement.setInt(1, groupID);
            statement.setInt(2, memberID);
            statement.setString(3, memberName);
            statement.setInt(4, privilege);
            statement.setTimestamp(5, creationDate);
            statement.setTimestamp(6, modifiedDate);

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

    public void delete(int groupID, int memberID)
        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 MemberID = ?");

        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, groupID);
            statement.setInt(2, memberID);
            if (statement.executeUpdate() != 1) {
                throw new ObjectNotFoundException("Cannot delete a row in table MemberGroup where primary key = (" + groupID + ", " + memberID + ").");
            }
            m_dirty = true;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in MemberGroupDAOImplJDBC.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 MemberGroupDAOImplJDBC.delete_inGroup.");
        } finally {
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public void delete_inMember(int memberID)
        throws DatabaseException {

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

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

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

/************************************************
 * Customized methods come below
 ************************************************/
    /*
     * Included columns: MemberID, MemberName, Privilege, CreationDate, ModifiedDate
     * Excluded columns: GroupID
     */
    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 MemberID, MemberName, Privilege, CreationDate, ModifiedDate");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE GroupID = ?");
        sql.append(" ORDER BY MemberID ASC ");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, groupID);
            resultSet = statement.executeQuery();
            while (resultSet.next()) {
                MemberGroupBean bean = new MemberGroupBean();
                bean.setGroupID(groupID);
                bean.setMemberID(resultSet.getInt("MemberID"));
                bean.setMemberName(resultSet.getString("MemberName"));
                bean.setPrivilege(resultSet.getInt("Privilege"));
                bean.setCreationDate(resultSet.getTimestamp("CreationDate"));
                bean.setModifiedDate(resultSet.getTimestamp("ModifiedDate"));
                retValue.add(bean);
            }
            return retValue;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in MemberGroupDAOImplJDBC.getBeans_inGroup.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public int getNumberOfBeans_inGroup(int groupID)
        throws AssertionException, DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT Count(*)");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE GroupID = ?");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, groupID);
            resultSet = statement.executeQuery();
            if (!resultSet.next()) {
                throw new AssertionException("Assertion in MemberGroupDAOImplJDBC.getNumberOfBeans_inGroup.");
            }
            return resultSet.getInt(1);
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in MemberGroupDAOImplJDBC.getNumberOfBeans_inGroup.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

}// end of class MemberGroupDAOImplJDBC

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲最大色网站| 在线一区二区三区| 91蜜桃免费观看视频| 51精品秘密在线观看| 欧美肥胖老妇做爰| 精品一区二区三区免费观看| 五月天国产精品| 一本到一区二区三区| 亚洲小说欧美激情另类| 久久久久久一二三区| 欧美精品久久一区| 欧美一二三区在线| 精品精品国产高清a毛片牛牛| 欧美一区二区成人6969| 国产精品丝袜一区| 欧美三级资源在线| 欧美一级黄色片| 欧美精品一卡二卡| 成人av电影在线播放| 国产一区二区视频在线| 国产综合色在线| 韩国欧美国产1区| 国产一区二区三区香蕉| 亚洲欧美色一区| 国产调教视频一区| 91精品国产一区二区三区香蕉| 久久99精品国产麻豆不卡| 成人精品小蝌蚪| 在线观看成人小视频| 欧美日韩一区 二区 三区 久久精品| 成人av高清在线| 国产成人综合视频| 日韩视频123| 欧美大片顶级少妇| 欧美高清精品3d| 日本不卡123| 日韩欧美成人一区二区| 国产精品欧美一区喷水| 成人欧美一区二区三区在线播放| 99久久免费视频.com| 午夜视频在线观看一区二区三区| 欧美日韩一级视频| 日韩国产高清影视| 欧美日韩精品三区| 丝袜亚洲另类欧美| 91精品国产91久久久久久最新毛片| 亚洲国产aⅴ天堂久久| 日本精品免费观看高清观看| 久久九九全国免费| 成人黄色片在线观看| 亚洲精品乱码久久久久久久久| 精品一区二区三区影院在线午夜 | 精品污污网站免费看| 欧美一区二区成人| 日韩精品一卡二卡三卡四卡无卡| 国产一区二区三区黄视频 | 美女视频黄免费的久久| 成人app在线观看| 一区二区三区成人| 亚洲h在线观看| 天堂午夜影视日韩欧美一区二区| 一区二区免费看| 夫妻av一区二区| 久久久99免费| 一区二区三区在线观看视频| 69久久夜色精品国产69蝌蚪网| 国产伦精一区二区三区| 午夜欧美在线一二页| 26uuu亚洲| 日韩一区二区免费高清| 欧美性生活大片视频| 国产成人免费视| 日本一区二区免费在线| 成人免费观看男女羞羞视频| 欧美精品一区二区三区一线天视频 | 久久久国际精品| 亚洲欧洲一区二区三区| 国产精品1区2区3区在线观看| 色综合久久88色综合天天6| 国产精品一区二区视频| 亚洲天堂免费在线观看视频| 在线不卡欧美精品一区二区三区| 久久99精品国产91久久来源| 一区二区在线观看不卡| 2024国产精品视频| 欧美日韩大陆一区二区| 福利一区福利二区| 日韩av网站在线观看| 中文字幕日本乱码精品影院| 4hu四虎永久在线影院成人| 成人综合激情网| 免费成人av在线播放| 亚洲欧美色图小说| 久久精品亚洲麻豆av一区二区| 欧美视频一区二区三区在线观看| 国内久久精品视频| 日精品一区二区| 亚洲精品中文在线影院| 91麻豆精品国产91久久久使用方法 | 天堂av在线一区| 国产精品短视频| 久久综合999| 欧美日韩另类国产亚洲欧美一级| 成人激情动漫在线观看| 国产呦萝稀缺另类资源| 日本午夜一本久久久综合| 亚洲黄一区二区三区| 国产精品久久久久影院老司| www日韩大片| 欧美一区二区三区免费观看视频 | 亚洲色大成网站www久久九九| 久久久久久久久97黄色工厂| 欧美一二三区精品| 亚洲欧洲日产国码二区| 欧美午夜精品久久久久久超碰| 国产一区美女在线| 久久成人综合网| 毛片一区二区三区| 午夜精品久久久| 亚洲福利视频导航| 中文字幕一区二区三区在线观看| 久久精品视频一区二区三区| 久久蜜桃av一区二区天堂 | 亚洲精品乱码久久久久久久久 | 91麻豆精品国产91久久久久久久久| 91电影在线观看| 欧美日韩视频在线观看一区二区三区 | 欧美麻豆精品久久久久久| 欧美变态tickle挠乳网站| 亚洲午夜私人影院| 懂色av一区二区三区免费看| 国产成人av一区二区| 国产亚洲欧洲一区高清在线观看| 色综合久久久网| 6080午夜不卡| 亚洲欧洲日韩av| 18成人在线视频| 国产精一品亚洲二区在线视频| 色噜噜狠狠成人网p站| 日韩视频免费观看高清完整版在线观看| 国产色综合久久| 精品一区二区国语对白| 国产老妇另类xxxxx| 亚洲成人综合视频| 在线亚洲一区二区| 欧美哺乳videos| 国产精品福利一区| 五月天国产精品| 成人手机电影网| 欧美岛国在线观看| 日产国产高清一区二区三区| 91视频免费观看| 亚洲图片欧美综合| 国产亚洲午夜高清国产拍精品| 99在线精品观看| 日本视频免费一区| 亚洲免费观看高清完整版在线 | 亚洲午夜视频在线| 日韩精品中文字幕一区| 国产精品一二三四| 亚洲成人免费在线观看| 精品国产乱码久久久久久免费| 精久久久久久久久久久| 国产成人av一区二区三区在线 | 国产精品久久影院| 韩国精品一区二区| 欧美α欧美αv大片| 成人免费黄色在线| 三级精品在线观看| 精品欧美乱码久久久久久1区2区| 久99久精品视频免费观看| 亚洲综合久久av| 国产精品18久久久久| 欧美日韩一区中文字幕| 国产日韩三级在线| 免费高清在线视频一区·| 91在线观看美女| 精品国产一区a| 婷婷一区二区三区| 91免费视频网址| 久久久五月婷婷| 蜜桃视频在线观看一区| 一本色道综合亚洲| 国产精品欧美一区喷水| 国产一区二区精品在线观看| 6080亚洲精品一区二区| 亚洲国产sm捆绑调教视频| 色哟哟国产精品免费观看| 日本一区二区三区四区| 国产麻豆日韩欧美久久| 日韩免费观看高清完整版在线观看| 伊人色综合久久天天| 97久久精品人人做人人爽50路| 国产色产综合色产在线视频| 免费观看30秒视频久久| 日韩欧美视频一区| 久久精品国产99| 日韩精品最新网址| 美脚の诱脚舐め脚责91| 日韩欧美电影一二三|