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

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

?? attachmentdaoimpljdbc.java

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

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

    protected static boolean isDirty() {
        return m_dirty;
    }

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

    /*
     * Included columns: PostID, MemberID, AttachFilename, AttachFileSize, AttachMimeType,
     *                   AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate, AttachDownloadCount,
     *                   AttachOption, AttachStatus
     * Excluded columns: AttachID
     */
    public void create(int postID, int memberID, String attachFilename,
                        int attachFileSize, String attachMimeType, String attachDesc,
                        String attachCreationIP, Timestamp attachCreationDate, Timestamp attachModifiedDate,
                        int attachDownloadCount, int attachOption, int attachStatus)
                        throws CreateException, DatabaseException, ForeignKeyNotFoundException {

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

        //if admin allowed guest to send attachmanets, we must allow that too
        if (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().findByPrimaryKey(memberID);
            } catch(ObjectNotFoundException e) {
                throw new ForeignKeyNotFoundException("Foreign key refers to table 'Member' does not exist. Cannot create new Attachment.");
            }
        }

        Connection connection = null;
        PreparedStatement statement = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("INSERT INTO " + TABLE_NAME + " (PostID, MemberID, AttachFilename, AttachFileSize, AttachMimeType, AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate, AttachDownloadCount, AttachOption, AttachStatus)");
        sql.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());

            statement.setInt(1, postID);
            statement.setInt(2, memberID);
            statement.setString(3, attachFilename);
            statement.setInt(4, attachFileSize);
            statement.setString(5, attachMimeType);
            statement.setString(6, attachDesc);
            statement.setString(7, attachCreationIP);
            statement.setTimestamp(8, attachCreationDate);
            statement.setTimestamp(9, attachModifiedDate);
            statement.setInt(10, attachDownloadCount);
            statement.setInt(11, attachOption);
            statement.setInt(12, attachStatus);

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

    public int createAttachment(int postID, int memberID, String attachFilename,
                        int attachFileSize, String attachMimeType, String attachDesc,
                        String attachCreationIP, Timestamp attachCreationDate, Timestamp attachModifiedDate,
                        int attachDownloadCount, int attachOption, int attachStatus)
                        throws CreateException, DatabaseException, ForeignKeyNotFoundException, ObjectNotFoundException {

         create(postID, memberID, attachFilename, attachFileSize, attachMimeType, attachDesc, attachCreationIP, attachCreationDate, attachModifiedDate, attachDownloadCount, attachOption, attachStatus);

        int attachID = 0;
        try {
            attachID = findAttachID(postID, memberID, attachCreationDate);
        } catch (ObjectNotFoundException ex) {
            // Hack the Oracle 9i problem
            Timestamp roundTimestamp = new Timestamp((attachCreationDate.getTime()/1000)*1000);
            attachID = findAttachID(postID, memberID, roundTimestamp);
        }
        return attachID;
    }

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

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

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

    /*
     * Included columns: PostID, MemberID, AttachFilename, AttachFileSize, AttachMimeType,
     *                   AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate, AttachDownloadCount,
     *                   AttachOption, AttachStatus
     * Excluded columns: AttachID
     */
    public AttachmentBean getBean(int attachID)
        throws ObjectNotFoundException, DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT PostID, MemberID, AttachFilename, AttachFileSize, AttachMimeType, AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate, AttachDownloadCount, AttachOption, AttachStatus");
        sql.append(" FROM " + TABLE_NAME);
        sql.append(" WHERE AttachID = ?");
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            statement.setInt(1, attachID);
            resultSet = statement.executeQuery();
            if(!resultSet.next()) {
                throw new ObjectNotFoundException("Cannot find the row in table Attachment where primary key = (" + attachID + ").");
            }

            AttachmentBean bean = new AttachmentBean();
            bean.setAttachID(attachID);
            bean.setPostID(resultSet.getInt("PostID"));
            bean.setMemberID(resultSet.getInt("MemberID"));
            bean.setAttachFilename(resultSet.getString("AttachFilename"));
            bean.setAttachFileSize(resultSet.getInt("AttachFileSize"));
            bean.setAttachMimeType(resultSet.getString("AttachMimeType"));
            bean.setAttachDesc(resultSet.getString("AttachDesc"));
            bean.setAttachCreationIP(resultSet.getString("AttachCreationIP"));
            bean.setAttachCreationDate(resultSet.getTimestamp("AttachCreationDate"));
            bean.setAttachModifiedDate(resultSet.getTimestamp("AttachModifiedDate"));
            bean.setAttachDownloadCount(resultSet.getInt("AttachDownloadCount"));
            bean.setAttachOption(resultSet.getInt("AttachOption"));
            bean.setAttachStatus(resultSet.getInt("AttachStatus"));
            return bean;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in AttachmentDAOImplJDBC.getBean(pk).");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    /*
     * Included columns: AttachID, PostID, MemberID, AttachFilename, AttachFileSize,
     *                   AttachMimeType, AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate,
     *                   AttachDownloadCount, AttachOption, AttachStatus
     * Excluded columns:
     */
    public Collection getBeans()
        throws DatabaseException {

        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        Collection retValue = new ArrayList();
        StringBuffer sql = new StringBuffer(512);
        sql.append("SELECT AttachID, PostID, MemberID, AttachFilename, AttachFileSize, AttachMimeType, AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate, AttachDownloadCount, AttachOption, AttachStatus");
        sql.append(" FROM " + TABLE_NAME);
        //sql.append(" WHERE "); // @todo: uncomment as needed
        //sql.append(" ORDER BY ColumnName ASC|DESC "); // @todo: uncomment as needed
        try {
            connection = DBUtils.getConnection();
            statement = connection.prepareStatement(sql.toString());
            resultSet = statement.executeQuery();
            while (resultSet.next()) {
                AttachmentBean bean = new AttachmentBean();
                bean.setAttachID(resultSet.getInt("AttachID"));
                bean.setPostID(resultSet.getInt("PostID"));
                bean.setMemberID(resultSet.getInt("MemberID"));
                bean.setAttachFilename(resultSet.getString("AttachFilename"));
                bean.setAttachFileSize(resultSet.getInt("AttachFileSize"));
                bean.setAttachMimeType(resultSet.getString("AttachMimeType"));
                bean.setAttachDesc(resultSet.getString("AttachDesc"));
                bean.setAttachCreationIP(resultSet.getString("AttachCreationIP"));
                bean.setAttachCreationDate(resultSet.getTimestamp("AttachCreationDate"));
                bean.setAttachModifiedDate(resultSet.getTimestamp("AttachModifiedDate"));
                bean.setAttachDownloadCount(resultSet.getInt("AttachDownloadCount"));
                bean.setAttachOption(resultSet.getInt("AttachOption"));
                bean.setAttachStatus(resultSet.getInt("AttachStatus"));
                retValue.add(bean);
            }
            return retValue;
        } catch(SQLException sqle) {
            log.error("Sql Execution Error!", sqle);
            throw new DatabaseException("Error executing SQL in AttachmentDAOImplJDBC.getBeans.");
        } finally {
            DBUtils.closeResultSet(resultSet);
            DBUtils.closeStatement(statement);
            DBUtils.closeConnection(connection);
        }
    }

    public int getNumberOfBeans()
        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 "); // @todo: uncomment as needed
        try {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区视频| 成人av在线电影| 日韩一区二区在线观看视频| 亚洲午夜精品久久久久久久久| 日本道精品一区二区三区| 亚洲精选免费视频| 欧美精品在线视频| 久久精品国产秦先生| 久久精品视频免费观看| 成人国产精品免费观看视频| 亚洲精品日产精品乱码不卡| 欧美日韩精品一区二区三区四区| 日韩激情中文字幕| 国产日产欧美精品一区二区三区| 99久久er热在这里只有精品15| 亚洲一区在线视频观看| 欧美一区二区三区日韩| 国产91丝袜在线18| 亚洲一区二区影院| 337p粉嫩大胆色噜噜噜噜亚洲| 成人午夜在线免费| 午夜激情久久久| 国产人成亚洲第一网站在线播放| 色综合久久久久综合99| 日韩电影在线免费观看| 欧美激情综合五月色丁香| 欧美日韩卡一卡二| 国产91在线看| 日韩电影免费在线| 最新久久zyz资源站| 制服丝袜激情欧洲亚洲| 成人禁用看黄a在线| 日韩黄色在线观看| 中文字幕一区二区三区不卡 | 欧美日韩电影在线播放| 激情综合一区二区三区| 亚洲综合激情小说| 国产精品每日更新在线播放网址 | 蜜臀av性久久久久蜜臀aⅴ四虎| 久久久国产精品午夜一区ai换脸| 色综合久久久久久久久久久| 精品一区二区三区免费毛片爱| 综合久久久久久| 精品剧情在线观看| 欧美日韩成人在线| 欧美日韩高清一区二区三区| 久久国产乱子精品免费女| 一区二区三区国产精品| 久久久久久9999| 日韩一区二区三区电影 | 亚洲一区二区三区三| 国产片一区二区| 欧美成人女星排名| 欧美日韩情趣电影| 日本韩国欧美一区二区三区| 国产成人综合视频| 激情综合色综合久久| 婷婷开心激情综合| 亚洲线精品一区二区三区八戒| 国产精品久久国产精麻豆99网站 | 久久久综合视频| 日韩亚洲欧美一区| 欧美精品在线观看播放| 欧美丝袜自拍制服另类| 91福利国产成人精品照片| 91免费看`日韩一区二区| 国产成人av电影在线| 另类小说综合欧美亚洲| 日本亚洲免费观看| 日韩在线a电影| 日本欧美一区二区在线观看| 亚洲高清视频的网址| 亚洲香肠在线观看| 五月综合激情网| 午夜精品免费在线| 丝袜诱惑亚洲看片| 天天色综合天天| 日本伊人精品一区二区三区观看方式| 亚洲超碰97人人做人人爱| 亚洲成a人片在线观看中文| 亚洲第一成人在线| 天天色 色综合| 理论片日本一区| 国产乱子伦一区二区三区国色天香| 蜜臀精品一区二区三区在线观看| 色婷婷一区二区| 欧美日韩免费高清一区色橹橹| 欧美日韩一区二区三区四区| 欧美日韩成人综合天天影院 | 99国产精品国产精品久久| 91婷婷韩国欧美一区二区| 91免费视频网| 欧美视频中文一区二区三区在线观看| 精品视频免费在线| 日韩午夜av一区| 久久久久国产精品麻豆| 国产精品国产三级国产aⅴ中文 | 国产精品久99| 亚洲欧美日韩一区| 亚洲成av人片一区二区梦乃| 日本va欧美va瓶| 国产黑丝在线一区二区三区| 99久久99久久久精品齐齐| 日本精品免费观看高清观看| 欧美日本一道本| 精品成人一区二区三区四区| 国产日韩欧美精品在线| 一区二区三区美女视频| 美女在线观看视频一区二区| 国产成人日日夜夜| 欧美在线免费观看亚洲| 日韩欧美色电影| 国产精品美日韩| 亚洲chinese男男1069| 青娱乐精品在线视频| 成人深夜福利app| 欧美日韩一区成人| 久久久亚洲高清| 亚洲免费av在线| 激情综合色丁香一区二区| 色综合中文字幕国产 | 国产日韩v精品一区二区| 一区二区三区欧美亚洲| 激情欧美一区二区| 91免费版在线| 欧美videossexotv100| 中文字幕在线观看不卡| 奇米精品一区二区三区四区| 成人18精品视频| 欧美大胆一级视频| 亚洲理论在线观看| 国产成人av电影在线| 欧美一区二区三区视频免费播放| 国产精品久久久久久久裸模| 裸体一区二区三区| 在线观看日韩一区| 国产精品久久久一本精品| 美女视频网站久久| 欧美日韩欧美一区二区| 亚洲三级在线看| 国产盗摄视频一区二区三区| 欧美电影影音先锋| 悠悠色在线精品| 成人av网址在线| 久久嫩草精品久久久久| 蜜臀精品一区二区三区在线观看 | 肉色丝袜一区二区| 在线看日韩精品电影| 中文字幕成人av| 蜜桃视频一区二区三区在线观看| 日本二三区不卡| 亚洲乱码国产乱码精品精的特点| 岛国精品在线播放| 国产人成一区二区三区影院| 韩国v欧美v日本v亚洲v| 欧美大片拔萝卜| 美女国产一区二区三区| 日韩欧美在线综合网| 日本一区中文字幕| 日韩一区二区三区三四区视频在线观看 | 日韩一区二区在线观看| 天堂蜜桃一区二区三区| 精品视频在线免费| 天涯成人国产亚洲精品一区av| 欧美三级视频在线| 午夜久久久影院| 欧美人成免费网站| 日韩精品一级中文字幕精品视频免费观看 | 在线视频国内一区二区| 伊人色综合久久天天| 欧洲精品视频在线观看| 亚洲裸体在线观看| 在线观看网站黄不卡| 一区二区三区精密机械公司| 欧洲一区在线电影| 午夜一区二区三区在线观看| 欧美三级三级三级| 日av在线不卡| 亚洲精品一区二区三区蜜桃下载| 九九视频精品免费| 国产日韩欧美精品电影三级在线| 成人性色生活片免费看爆迷你毛片| 欧美韩日一区二区三区四区| www.日本不卡| 亚洲一区二区中文在线| 欧美一区二区三区性视频| 精品一区二区三区在线观看| 亚洲精品在线网站| av在线综合网| 亚洲一区二区偷拍精品| 日韩一区二区三区三四区视频在线观看| 蜜臀99久久精品久久久久久软件| 欧美精品一区二| 91亚洲男人天堂| 一区二区三区高清不卡| 日韩欧美国产一区在线观看| 国产另类ts人妖一区二区| 一区二区中文字幕在线| 欧美日韩精品一区二区三区| 久久国产精品色婷婷|