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

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

?? groupsdaoimpljdbc.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/jdbc/GroupsDAOImplJDBC.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 GroupsDAOImplJDBC implements GroupsDAO {

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

    protected static boolean isDirty() {
        return m_dirty;
    }

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

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

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT GroupID");
        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 ObjectNotFoundException("Cannot find the primary key (" + groupID + ") in table 'Groups'.");
            }
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in GroupsDAOImplJDBC.findByPrimaryKey.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public void findByAlternateKey_GroupName(String groupName)
        throws ObjectNotFoundException, DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT GroupName");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE GroupName = ?");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setString(1, groupName);
            resultSet = statement.executeQuery();
            if (!resultSet.next()) {
                throw new ObjectNotFoundException("Cannot find the alternate key <GroupName> (" + groupName + ") in table 'Groups'.");
            }
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in GroupsDAOImplJDBC.findByAlternateKey_GroupName.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    /*
     * Included columns: GroupOwnerID, GroupOwnerName, GroupName, GroupDesc, GroupOption,
     *                   GroupCreationDate, GroupModifiedDate
     * Excluded columns: GroupID
     */
    /**
     * NOTE: This is a customized method, it get groupOwnerID from groupOwnerName
     *      and I remove the groupOwnerID from the parameter list
     */
    public void create(String groupOwnerName, String groupName,
                        String groupDesc, int groupOption, Timestamp groupCreationDate,
                        Timestamp groupModifiedDate)
        throws CreateException, DatabaseException, DuplicateKeyException, ForeignKeyNotFoundException {

        int groupOwnerID = 0;// MUST init to 0, or this method will be wrong

        // @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
        try {
            //Check if alternate key already exists
            findByAlternateKey_GroupName(groupName);
            //If so, then we have to throw an exception
            throw new DuplicateKeyException("Alternate key already exists. Cannot create new Groups with the same <GroupName> (" + groupName + ").");
        } 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'
            groupOwnerID = 0;
            if ((groupOwnerName!=null) && (groupOwnerName.length()>0)) {// have group owner
                DAOFactory.getMemberDAO().findByAlternateKey_MemberName(groupOwnerName);
                try {
                    groupOwnerID = DAOFactory.getMemberDAO().getMemberIDFromMemberName(groupOwnerName);
                } catch (ObjectNotFoundException ex) {
                    // This exception should never be thrown
                    throw new ObjectNotFoundException("ASSERTION: This should never happen.");
                }
            }
        } catch(ObjectNotFoundException e) {
            throw new ForeignKeyNotFoundException("Foreign key refers to table 'Member' does not exist. Cannot create new Groups.");
        }

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("INSERT INTO " + TABLE_NAME + " (GroupOwnerID, GroupOwnerName, GroupName, GroupDesc, GroupOption, GroupCreationDate, GroupModifiedDate)");
        sql.append(" VALUES (?, ?, ?, ?, ?, ?, ?)");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());

            statement.setInt(1, groupOwnerID);
            statement.setString(2, groupOwnerName);
            statement.setString(3, groupName);
            statement.setString(4, groupDesc);
            statement.setInt(5, groupOption);
            statement.setTimestamp(6, groupCreationDate);
            statement.setTimestamp(7, groupModifiedDate);

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

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

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

    /*
     * Included columns: GroupName, GroupDesc, GroupModifiedDate
     * Excluded columns: GroupID, GroupOwnerID, GroupOption, GroupCreationDate
     */
    public void update(int groupID, // primary key
                        String groupName, String groupDesc, Timestamp groupModifiedDate)
        throws ObjectNotFoundException, DatabaseException, DuplicateKeyException {

        GroupsBean bean = getBean(groupID); // @todo: comment or delete this line if no alternate key are included

        if ( !groupName.equals(bean.getGroupName()) ) {
            // Groups tries to change its alternate key <GroupName>, so we must check if it already exist
            try {
                findByAlternateKey_GroupName(groupName);
                throw new DuplicateKeyException("Alternate key <GroupName> (" + groupName + ")already exists. Cannot update Groups.");
            } catch(ObjectNotFoundException e) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲福利视频一区二区| 91视频观看视频| 一个色综合网站| 一区二区三区在线视频免费观看| 久久日韩精品一区二区五区| 日韩三级中文字幕| 日韩欧美电影在线| 久久欧美中文字幕| 久久久国产午夜精品| 国产天堂亚洲国产碰碰| 国产日韩成人精品| 国产精品久99| 亚洲一区二区欧美日韩| 日韩在线一二三区| 国产美女精品一区二区三区| 国产不卡视频在线观看| 97国产精品videossex| 91麻豆国产福利在线观看| 欧美性videosxxxxx| av在线不卡网| 中文字幕高清一区| 亚洲一区二区视频在线观看| 亚洲一区二区三区精品在线| 秋霞国产午夜精品免费视频| 国产高清视频一区| 欧美视频在线一区二区三区 | 欧美激情一区二区在线| 日本一区二区三区久久久久久久久不| 亚洲国产精品av| 一个色综合av| 国产揄拍国内精品对白| 色猫猫国产区一区二在线视频| 欧美高清www午色夜在线视频| 亚洲精品一区二区三区99| 亚洲欧美日韩国产中文在线| 亚洲精品免费在线观看| 久久er99精品| 91精彩视频在线观看| 26uuu成人网一区二区三区| 国产精品的网站| 久久草av在线| 欧美日韩激情一区二区三区| 国产天堂亚洲国产碰碰| 日本伊人午夜精品| bt欧美亚洲午夜电影天堂| 欧美一区二区网站| 亚洲黄色av一区| 国产福利视频一区二区三区| 欧美日韩三级一区| 国产精品久久久久久久浪潮网站| 亚洲欧美国产高清| 中文字幕精品综合| 麻豆精品在线观看| 欧美三级三级三级| 中文字幕一区二区三| 毛片基地黄久久久久久天堂| 欧美在线影院一区二区| 久久久91精品国产一区二区精品 | 97se亚洲国产综合自在线不卡| 欧美天堂一区二区三区| 久久综合九色综合97婷婷女人| 亚洲人成影院在线观看| 成人av动漫在线| 国产亚洲精品资源在线26u| 亚洲电影第三页| 91国产福利在线| 欧美激情中文字幕| 亚洲一区二区免费视频| 成人短视频下载| 国产日韩欧美在线一区| 精品一区二区在线免费观看| 91麻豆精品国产91久久久久久久久| 亚洲一区二区三区不卡国产欧美| 99国产精品一区| 亚洲免费高清视频在线| 成人午夜av电影| 综合网在线视频| 久久久噜噜噜久久中文字幕色伊伊| 欧美aaa在线| 欧美大片在线观看| 久久国内精品自在自线400部| 日韩三级中文字幕| 国产一区二区导航在线播放| 欧美大片免费久久精品三p| 久久99精品久久久久久动态图 | 久久综合久久久久88| 激情五月激情综合网| 精品成a人在线观看| 国产电影精品久久禁18| 国产精品丝袜久久久久久app| 99精品视频一区二区三区| 亚洲免费观看高清完整版在线观看| 99re这里只有精品6| 亚洲一区在线观看免费 | 国产精品天干天干在观线| 91亚洲男人天堂| 亚洲二区视频在线| 亚洲精品一区二区三区四区高清| 国产精品一区二区在线看| 国产精品久久毛片| 欧美日韩一区二区电影| 国内精品在线播放| 最新国产成人在线观看| 欧美精品在线观看一区二区| 韩国毛片一区二区三区| 亚洲三级视频在线观看| 亚洲欧美日韩久久| 日韩精品在线看片z| 91影院在线观看| 久久av资源站| 亚洲午夜成aⅴ人片| 2023国产精品自拍| 在线观看精品一区| 激情综合一区二区三区| 一区二区三区在线观看网站| 欧美tickle裸体挠脚心vk| 99久久精品国产观看| 蜜臀国产一区二区三区在线播放| 欧美国产丝袜视频| 日韩欧美视频在线| 91激情在线视频| 成人av网站在线| 精品中文字幕一区二区小辣椒| 中文字幕在线观看一区| 欧美一区二区三区小说| 色爱区综合激月婷婷| 国产精品一区二区在线观看网站| 亚洲午夜精品网| 国产精品成人免费精品自在线观看| 欧美一区二区在线看| 在线观看日产精品| 不卡av在线免费观看| 国产一区二区精品久久99| 视频一区视频二区中文| 一区二区三区免费网站| 国产精品久久午夜| 久久久亚洲精品一区二区三区| 欧美一级夜夜爽| 7777女厕盗摄久久久| 色天使色偷偷av一区二区| 成人a免费在线看| 精品中文字幕一区二区小辣椒| 亚洲成人av福利| 99精品视频免费在线观看| 国产69精品久久久久777| 国产传媒欧美日韩成人| 卡一卡二国产精品 | 国产精品一区免费视频| 日本亚洲最大的色成网站www| 亚欧色一区w666天堂| 一区二区三区欧美视频| 亚洲免费av高清| 一区二区日韩av| 亚洲国产日韩一级| 亚洲国产美女搞黄色| 亚洲一区二区在线免费观看视频| 成人免费视频在线观看| 亚洲男女一区二区三区| 亚洲精品国产a久久久久久| 一区二区三区日韩欧美精品| 樱桃国产成人精品视频| 亚洲成人福利片| 日韩av一区二区三区四区| 蜜臀av一级做a爰片久久| 精品一区二区综合| 国产成人av一区| 99久久综合99久久综合网站| www.亚洲免费av| 色婷婷国产精品久久包臀| 精品婷婷伊人一区三区三| 欧美日本视频在线| 欧美成人欧美edvon| 国产亚洲成aⅴ人片在线观看| 中文字幕一区二区在线观看 | 26uuu亚洲综合色欧美| 国产欧美日本一区视频| 亚洲人成在线播放网站岛国| 性欧美大战久久久久久久久| 老司机精品视频一区二区三区| 国产一区二区三区在线观看精品| 高清成人免费视频| 欧美性大战久久| 亚洲精品在线电影| 亚洲欧美日韩人成在线播放| 午夜视频一区二区三区| 国产一区在线观看视频| 99精品视频中文字幕| 7777精品伊人久久久大香线蕉经典版下载 | 欧美午夜片在线看| 精品三级av在线| 亚洲视频1区2区| 亚洲成a人v欧美综合天堂下载| 蜜乳av一区二区| 91网站最新地址| 欧美日韩一区二区电影| 欧美一区二区免费视频| 亚洲色图在线看| 激情综合网av| 欧美日韩一区不卡| 国产精品激情偷乱一区二区∴|