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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? rdbmstool.java

?? 一個(gè)java方面的消息訂閱發(fā)送的源碼
?? JAVA
字號(hào):
/**
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided
 * that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright
 *    statements and notices.  Redistributions must also contain a
 *    copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions and the
 *    following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. The name "Exolab" must not be used to endorse or promote
 *    products derived from this Software without prior written
 *    permission of Exoffice Technologies.  For written permission,
 *    please contact info@exolab.org.
 *
 * 4. Products derived from this Software may not be called "Exolab"
 *    nor may "Exolab" appear in their names without prior written
 *    permission of Exoffice Technologies. Exolab is a registered
 *    trademark of Exoffice Technologies.
 *
 * 5. Due credit should be given to the Exolab Project
 *    (http://www.exolab.org/).
 *
 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2001-2005 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: RDBMSTool.java,v 1.2 2005/04/08 13:52:14 tanderson Exp $
 */
package org.exolab.jms.tools.db;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.exolab.jms.persistence.PersistenceException;
import org.exolab.jms.persistence.SQLHelper;


/**
 * This class provides support for creating and destroying tables in RDBMS
 * databases.
 *
 * @version     $Revision: 1.2 $ $Date: 2005/04/08 13:52:14 $
 * @author      <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 */
public class RDBMSTool {

    /**
     * The connection to the database.
     */
    private Connection _connection = null;

    /**
     * The schema browser.
     */
    private SchemaBrowser _browser = null;

    /**
     * The logger
     */
    private static final Log _log = LogFactory.getLog(RDBMSTool.class);


    /**
     * Construct a new <code>RDBMSTool</code>.
     *
     * @param connection the JDBC connection
     * @throws PersistenceException if database meta-data can't be obtained
     */
    public RDBMSTool(Connection connection) throws PersistenceException {
        _connection = connection;
        try {
            _connection.setAutoCommit(true);
        } catch (SQLException exception) {
            throw new PersistenceException("Failed to set auto-commit on",
                exception);
        }
        _browser = new SchemaBrowser(_connection);
    }

    /**
     * Creates the database.
     *
     * @param schema the database schema
     * @throws PersistenceException if elements cannot be created in the
     * database
     */
    public void create(Database schema) throws PersistenceException {
        Table[] tables = schema.getTable();
        for (int i = 0; i < tables.length; ++i) {
            create(tables[i]);
        }
    }

    /**
     * Drops tables from the database.
     *
     * @param schema the database schema
     * @throws PersistenceException if elements cannot be dropped from the
     * database
     */
    public void drop(Database schema) throws PersistenceException {
        Table[] tables = schema.getTable();
        for (int i = 0; i < tables.length; ++i) {
            drop(tables[i]);
        }
        Deprecated[] redundant = schema.getDeprecated();
        for (int i = 0; i < redundant.length; ++i) {
            dropTable(redundant[i].getName());
        }
    }

    /**
     * Close the connection to the database.
     */
    public void close() {
        SQLHelper.close(_connection);
    }

    /**
     * Creates a table in the database.
     *
     * @param table the table to create
     * @throws PersistenceException if the table exists, or cannot be created
     */
    public void create(Table table) throws PersistenceException {
        String name = table.getName();
        if (_browser.getTableExists(name)) {
            throw new PersistenceException(
                "An object already exists in the database named " + name);
        }

        StringBuffer sql = new StringBuffer("create table ");
        sql.append(name);
        sql.append(" (");

        _log.debug("Creating table: " + name);
        Attribute[] attributes = table.getAttribute();
        for (int i = 0; i < attributes.length; ++i) {
            if (i > 0) {
                sql.append(", ");
            }
            sql.append(attributes[i].getName());
            sql.append(" ");
            sql.append(getSQLType(attributes[i]));
        }
        sql.append(")");

        _log.debug("SQL=" + sql);
        Statement statement = null;
        try {
            statement = _connection.createStatement();
            statement.executeUpdate(sql.toString());
        } catch (SQLException exception) {
            throw new PersistenceException("Failed to create table=" + name,
                exception);
        } finally {
            SQLHelper.close(statement);
        }
        createIndexes(table);
    }

    /**
     * Drops a table from the database. If the table doesn't exist, then
     * it will be ignored.
     *
     * @param table the table to drop
     * @throws PersistenceException for any database error
     */
    public void drop(Table table) throws PersistenceException {
        dropTable(table.getName());
    }

    /**
     * Returns the schema browser.
     *
     * @return the schema browser
     */
    public SchemaBrowser getSchemaBrowser() {
        return _browser;
    }

    /**
     * Create indexes for a table.
     *
     * @param table the table to add indexes for
     * @throws PersistenceException
     */
    private void createIndexes(Table table) throws PersistenceException {
        Index[] indexes = table.getIndex();
        for (int i = 0; i < indexes.length; ++i) {
            Index index = indexes[i];
            StringBuffer sql = new StringBuffer("create ");
            if (index.getUnique()) {
                sql.append("unique ");
            }
            sql.append("index ");
            sql.append(index.getName());
            sql.append(" on ");
            sql.append(table.getName());
            sql.append("(");
            Column[] columns = index.getColumn();
            for (int j = 0; j < columns.length; ++j) {
                if (j > 0) {
                    sql.append(", ");
                }
                sql.append(columns[j].getName());
            }
            sql.append(")");
            _log.debug("SQL=" + sql);
            Statement statement = null;
            try {
                statement = _connection.createStatement();
                statement.executeUpdate(sql.toString());
            } catch (SQLException exception) {
                throw new PersistenceException(
                    "Failed to create index=" + index.getName() + " on table "
                    + table.getName());
            } finally {
                SQLHelper.close(statement);
            }
        }
    }

    /**
     * Drop a table.
     *
     * @param name the name of the table to drop
     * @throws PersistenceException if the drop fails
     */
    private void dropTable(String name) throws PersistenceException {
        if (_browser.getTableExists(name)) {
            String sql = "drop table " + name;
            _log.debug("SQL=" + sql);
            Statement statement = null;
            try {
                statement = _connection.createStatement();
                statement.executeUpdate(sql);
            } catch (SQLException exception) {
                throw new PersistenceException("Failed to drop table=" + name,
                    exception);
            } finally {
                SQLHelper.close(statement);
            }
        }
    }

    /**
     * Returns the SQL type for a given attribute.
     *
     * @param attribute the attribute
     * @return a string representation of the type
     * @throws PersistenceException if {@link Attribute#getType} is invalid, or
     * the RDBMS doesn't support the type
     */
    private String getSQLType(Attribute attribute)
        throws PersistenceException {
        Type result = _browser.getType(attribute);
        _log.debug("attribute=" + attribute.getName() + "->" + result);
        return result.getSQL();
    }

}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区成人精品| 中文字幕国产精品一区二区| 91精品国产免费久久综合| 欧美成人一区二区三区片免费 | 91麻豆精品国产自产在线| 欧美一级专区免费大片| 国产色综合一区| 亚洲乱码国产乱码精品精的特点| 午夜精品福利在线| 蜜桃精品视频在线| 成人深夜在线观看| 91国在线观看| 欧美变态tickling挠脚心| 亚洲国产精品高清| 舔着乳尖日韩一区| 国产成人精品亚洲777人妖| 在线观看日韩高清av| 精品国内片67194| 国内偷窥港台综合视频在线播放| 99国产精品久久久久久久久久久| 欧美男生操女生| 国产欧美视频一区二区| 亚洲成人av电影| 国产激情一区二区三区| 欧美午夜视频网站| 久久精品这里都是精品| 亚洲福利视频一区二区| 国产盗摄一区二区| 欧美日韩高清影院| 国产精品欧美一区二区三区| 日韩电影一二三区| 97se狠狠狠综合亚洲狠狠| 日韩一级免费观看| 亚洲人成影院在线观看| 国产老妇另类xxxxx| 欧美区视频在线观看| 国产精品拍天天在线| 精品影视av免费| 欧美怡红院视频| 欧美高清在线视频| 老汉av免费一区二区三区| 日本高清视频一区二区| 亚洲国产高清在线观看视频| 另类的小说在线视频另类成人小视频在线| 成人激情动漫在线观看| 精品国产三级电影在线观看| 一区二区三区中文在线| 粉嫩aⅴ一区二区三区四区 | 久久精品免视看| 日韩一区精品视频| 色天使色偷偷av一区二区| 欧美激情在线观看视频免费| 美女网站一区二区| 亚洲高清在线视频| www.欧美色图| 国产日韩欧美制服另类| 麻豆精品视频在线观看免费 | 亚洲欧洲日本在线| 国产福利视频一区二区三区| 日韩一区二区三区免费看| 亚洲国产一二三| 色先锋aa成人| 中文字幕欧美日本乱码一线二线 | 欧美日韩亚洲综合一区二区三区| 国产精品全国免费观看高清 | 欧美图区在线视频| 亚洲男帅同性gay1069| 成人av在线资源网站| 欧美国产精品一区| 国产精品一级片在线观看| 精品国产凹凸成av人网站| 免费一区二区视频| 日韩三级av在线播放| 日韩高清不卡一区| 欧美卡1卡2卡| 午夜国产精品一区| 亚洲精品日产精品乱码不卡| av一二三不卡影片| 国产精品二三区| 成人少妇影院yyyy| 国产精品美女久久久久av爽李琼| 国产成人在线看| 中文在线一区二区| 不卡免费追剧大全电视剧网站| 欧美精彩视频一区二区三区| 国产米奇在线777精品观看| 久久久99精品免费观看不卡| 国产精品影视天天线| 国产色产综合色产在线视频| 国产999精品久久久久久绿帽| 亚洲国产精品成人综合| 成人性色生活片免费看爆迷你毛片| 国产日韩欧美麻豆| av在线一区二区三区| 亚洲色大成网站www久久九九| 色综合激情五月| 亚洲五月六月丁香激情| 欧美夫妻性生活| 理论电影国产精品| 国产日产欧美一区二区三区 | 国产精品每日更新| 亚洲欧洲精品成人久久奇米网| av高清久久久| 亚洲一区二区综合| 91精品国产高清一区二区三区蜜臀| 久久精品国产网站| 日本一区二区三区久久久久久久久不| 成人精品在线视频观看| 一区二区三区在线观看国产| 欧美日韩国产a| 激情欧美一区二区| 国产精品欧美久久久久无广告| 色综合一区二区三区| 午夜精品久久久久久久蜜桃app| 欧美一级二级在线观看| 国产成人精品影视| 亚洲一区在线观看免费| 日韩精品在线看片z| 成人av在线一区二区| 五月激情六月综合| 久久久精品免费免费| 日本电影欧美片| 美女诱惑一区二区| 亚洲欧美在线aaa| 91精品国产综合久久国产大片| 丁香桃色午夜亚洲一区二区三区| 一区二区三区四区在线播放 | 亚洲一区二区三区四区五区中文| 亚洲午夜羞羞片| 久久亚区不卡日本| 欧美伊人久久大香线蕉综合69 | 欧美一区二区三区在线观看| 国产精品一级片在线观看| 亚洲精品国久久99热| 精品国产3级a| 91黄色免费看| 国产高清久久久| 亚洲成av人片观看| 国产精品天干天干在观线| 3d动漫精品啪啪1区2区免费| 成人精品视频.| 免费在线看一区| 亚洲黄一区二区三区| 久久欧美一区二区| 欧美乱妇一区二区三区不卡视频 | 欧美激情一区二区三区在线| 欧美三级电影在线观看| 国产成人欧美日韩在线电影| 午夜电影网亚洲视频| 国产精品白丝在线| 久久日一线二线三线suv| 欧美日韩国产一级片| av一区二区三区四区| 国产一区二区三区在线观看免费 | 午夜视频在线观看一区二区| 欧美—级在线免费片| 91精品国产综合久久久蜜臀粉嫩 | 国产二区国产一区在线观看| 偷窥少妇高潮呻吟av久久免费| 国产精品入口麻豆九色| 久久只精品国产| 欧美肥妇毛茸茸| 91国内精品野花午夜精品 | 久久久不卡网国产精品一区| 制服丝袜在线91| 91福利在线观看| 91在线精品秘密一区二区| 国产成人在线观看免费网站| 青青草原综合久久大伊人精品| 一区二区三区蜜桃网| 国产精品久久国产精麻豆99网站| 日本不卡中文字幕| 五月天亚洲婷婷| 亚洲国产精品精华液网站| 亚洲精品日产精品乱码不卡| 国产精品国产精品国产专区不蜜| 国产日韩欧美精品电影三级在线| 日韩欧美一二三| 91精品免费在线观看| 欧美片在线播放| 91.xcao| 欧美高清视频一二三区 | 亚洲高清不卡在线观看| 亚洲精品福利视频网站| 亚洲图片激情小说| 亚洲欧美日韩一区| 亚洲视频狠狠干| 亚洲免费av在线| 亚洲精品网站在线观看| 亚洲美腿欧美偷拍| 亚洲精品中文在线观看| 亚洲综合视频在线观看| 亚洲一区二区四区蜜桃| 亚洲国产精品久久久久婷婷884| 亚洲线精品一区二区三区八戒| 亚洲高清视频的网址| 午夜久久久久久久久久一区二区| 亚洲成在线观看| 日韩成人午夜电影| 久久激情五月激情|