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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? groupsdaoimpljdbc.java

?? 解觖java技術(shù)中后臺無法上傳數(shù)給的情況
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/jdbc/GroupsDAOImplJDBC.java,v 1.17 2006/04/14 17:05:26 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.17 $
 * $Date: 2006/04/14 17:05:26 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2006 by MyVietnam.net
 *
 * 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 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.
 *
 * 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 at MyVietnam net
 *
 * @author: Minh Nguyen  
 * @author: Mai  Nguyen  
 */
package com.mvnforum.db.jdbc;

import java.io.StringReader;
import java.sql.*;
import java.util.ArrayList;
import java.util.Collection;

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 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;

    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);
            if (DBUtils.getDatabaseType() == DBUtils.DATABASE_ORACLE) {
                statement.setCharacterStream(4, new StringReader(groupDesc), groupDesc.length());
            } else {
                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 = getGroup(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) {
                //Otherwise we can go ahead
            }
        }

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("UPDATE " + TABLE_NAME + " SET GroupName = ?, GroupDesc = ?, GroupModifiedDate = ?");
        sql.append(" WHERE GroupID = ?");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());

            // // column(s) to update
            statement.setString(1, groupName);
            if (DBUtils.getDatabaseType() == DBUtils.DATABASE_ORACLE) {
                statement.setCharacterStream(2, new StringReader(groupDesc), groupDesc.length());
            } else {
                statement.setString(2, groupDesc);
            }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区久久久久久| 中文字幕亚洲欧美在线不卡| 色妞www精品视频| 欧美乱妇23p| 亚洲国产毛片aaaaa无费看| 99这里都是精品| 国产传媒欧美日韩成人| 亚洲欧美国产77777| 国产精品系列在线播放| 7777精品伊人久久久大香线蕉的 | 日日欢夜夜爽一区| 国产精品天干天干在线综合| 国内精品在线播放| 丝袜a∨在线一区二区三区不卡 | 激情综合亚洲精品| 国产成人免费视频网站 | 久久成人免费网站| 亚洲精品视频在线| 中文字幕一区在线观看视频| 欧美大片顶级少妇| 欧美综合久久久| 国产91在线观看丝袜| 亚洲mv大片欧洲mv大片精品| 日韩精品专区在线影院重磅| 欧洲精品在线观看| 亚洲主播在线观看| 亚洲另类在线制服丝袜| 中文字幕第一区第二区| 日韩精品中文字幕一区| 日韩欧美一区二区免费| 欧美色区777第一页| 国产精选一区二区三区| 日韩和欧美的一区| 一区二区三区加勒比av| www成人在线观看| www欧美成人18+| 国产亚洲欧美在线| 91精品国产一区二区| 免费日韩伦理电影| 粉嫩久久99精品久久久久久夜| 欧美日韩一级片网站| 日韩午夜av电影| 精品国产三级a在线观看| 色欧美日韩亚洲| 国产专区综合网| 99re成人在线| 欧美xingq一区二区| 中文字幕制服丝袜一区二区三区| 欧美日韩电影在线| 亚洲精品欧美综合四区| 日韩高清一区二区| 99久久777色| 激情图区综合网| 亚洲成国产人片在线观看| 奇米色777欧美一区二区| 丁香天五香天堂综合| 国产精品女主播av| 久久色.com| 亚洲国产精品久久久男人的天堂| 成a人片亚洲日本久久| 欧美精品一区二区三区在线播放| 99久久精品国产观看| 97久久精品人人澡人人爽| 久久久久久久网| 亚洲精品视频免费观看| 91精品国产综合久久国产大片| 欧美日本国产一区| 亚洲一二三四区不卡| 欧美一区二视频| 欧美精品久久久久久久久老牛影院| 精品福利一区二区三区免费视频| 欧美疯狂做受xxxx富婆| 亚洲影视资源网| 在线欧美日韩精品| 国产亚洲视频系列| 亚洲va在线va天堂| 欧美狂野另类xxxxoooo| 99vv1com这只有精品| 极品瑜伽女神91| 日韩欧美黄色影院| 91香蕉视频黄| 久久综合色之久久综合| 国产一区二区在线看| 亚洲精品一区二区精华| 国产午夜亚洲精品羞羞网站| 久久免费偷拍视频| 日韩女优制服丝袜电影| 美女精品一区二区| 亚洲综合一区二区| 美日韩黄色大片| 色av综合在线| 一区二区三区中文字幕| 欧美日韩情趣电影| 日本亚洲最大的色成网站www| 欧美在线一区二区| 久久久国际精品| 欧美一区二区三区在线| 92精品国产成人观看免费| 日日夜夜精品视频免费| 一区二区三区在线免费| 天天综合网 天天综合色| 亚洲精品日日夜夜| 国产亚洲成av人在线观看导航 | 亚洲美女免费在线| 2023国产精品视频| 555夜色666亚洲国产免| 97精品视频在线观看自产线路二| 另类小说一区二区三区| 天天综合天天做天天综合| 亚洲午夜久久久久久久久电影网| 国产欧美一区二区精品仙草咪| 欧美大胆一级视频| 欧美一区二区三区人| 欧美精品 国产精品| 欧美另类变人与禽xxxxx| 欧美伊人久久久久久久久影院 | 国产精品美日韩| 久久精品亚洲乱码伦伦中文| 久久久国产精品不卡| 国产女人18毛片水真多成人如厕| 精品免费一区二区三区| 久久这里只精品最新地址| 精品成人一区二区三区| 麻豆精品视频在线| 日韩欧美自拍偷拍| 国产精品888| 国产精品午夜在线| 色综合久久久久网| 欧洲一区在线电影| 国产高清不卡二三区| 久久久99免费| 国产超碰在线一区| 一级做a爱片久久| 日韩欧美黄色影院| 国产精品一级二级三级| 亚洲综合小说图片| 日韩电影一二三区| 性久久久久久久| 亚洲不卡在线观看| 日韩成人伦理电影在线观看| 亚洲人成影院在线观看| 精品91自产拍在线观看一区| 99精品国产视频| 91浏览器打开| 欧美日韩国产美女| 欧美午夜不卡在线观看免费| 国产在线国偷精品免费看| 免费成人美女在线观看| 成人欧美一区二区三区黑人麻豆| 亚洲精品成人悠悠色影视| 一区二区三区免费看视频| 亚洲高清免费观看高清完整版在线观看| 亚洲人成影院在线观看| 日韩欧美国产成人一区二区| 精品视频123区在线观看| 欧美一级理论性理论a| 国产亚洲综合在线| 亚洲三级在线免费| 欧美系列日韩一区| 91网站在线播放| 欧美国产禁国产网站cc| 精品在线播放午夜| 日本道色综合久久| 欧美国产乱子伦| 日本欧美在线观看| av中文一区二区三区| 日韩一区二区三| 亚洲成人资源网| 91美女蜜桃在线| 国产三级精品三级| 国产欧美日韩麻豆91| 精品中文字幕一区二区小辣椒| 一区二区三区产品免费精品久久75| 亚洲蜜臀av乱码久久精品蜜桃| 国产精品白丝jk黑袜喷水| 国产精品欧美极品| 欧美日韩小视频| 国产一区二三区好的| 中文字幕一区二区三区不卡| 在线国产电影不卡| 蜜臀精品久久久久久蜜臀| 国产精品色噜噜| 欧美性大战久久久久久久蜜臀| 国内精品久久久久影院色| 亚洲欧美国产77777| 日韩欧美高清在线| 日本精品一区二区三区四区的功能| 亚洲福利视频导航| 国产嫩草影院久久久久| 欧洲人成人精品| 粉嫩一区二区三区性色av| 夜夜精品视频一区二区 | 久久久久国产精品麻豆| 91蜜桃视频在线| 国产乱人伦偷精品视频不卡| 婷婷国产在线综合| 欧美性生活影院| 日韩高清在线观看| 亚洲精品国久久99热| 国产精品色噜噜|