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

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

?? v061tov072schemaconverter.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
字號:
/**
 * 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 2002-2003 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: V061toV072SchemaConverter.java,v 1.1 2004/11/26 01:51:16 tanderson Exp $
 */
package org.exolab.jms.tools.db.migration;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

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

import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.exolab.jms.persistence.PersistenceException;
import org.exolab.jms.persistence.SQLHelper;
import org.exolab.jms.tools.db.Attribute;
import org.exolab.jms.tools.db.Database;
import org.exolab.jms.tools.db.InvalidTypeException;
import org.exolab.jms.tools.db.RDBMSTool;
import org.exolab.jms.tools.db.SchemaBrowser;
import org.exolab.jms.tools.db.SchemaConverter;
import org.exolab.jms.tools.db.SchemaHelper;
import org.exolab.jms.tools.db.Table;
import org.exolab.jms.tools.db.Type;


/**
 * A schema converter for converting from the 0.6.1 schema to the 0.7.2 schema
 *
 * @version     $Revision: 1.1 $ $Date: 2004/11/26 01:51:16 $
 * @author      <a href="mailto:tima@intalio.com">Tim Anderson</a>
 */
public class V061toV072SchemaConverter implements SchemaConverter {

    /**
     * The database connection
     */
    private Connection _connection;

    /**
     * The RDBMS tool
     */
    private RDBMSTool _tool;

    /**
     * The name of the destinations table
     */
    private static final String DESTINATIONS_TABLE = "destinations";

    /**
     * The name of the isQueue column
     */
    private static final String ISQUEUE_COLUMN = "isQueue";

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


    /**
     * Construct a new <code>V061toV072SchemaConverter</code>
     *
     * @param connection the connection to use
     */
    public V061toV072SchemaConverter(Connection connection) {
        _connection = connection;
    }

    public void convert() throws PersistenceException {
        Database schema = SchemaHelper.getSchema();
        try {
            if (_connection.getAutoCommit()) {
                _connection.setAutoCommit(false);
            }
            _tool = new RDBMSTool(_connection);
        } catch (SQLException exception) {
            throw new PersistenceException(exception.getMessage());
        }

        try {
            if (needsConversion(schema)) {
                doConvert(schema);
            }
            SchemaHelper.setVersion(_connection, "V0.7.2");
            _connection.commit();
        } catch (SQLException exception) {
            SQLHelper.rollback(_connection);
            throw new PersistenceException(exception);
        }
    }

    private boolean needsConversion(Database schema)
        throws PersistenceException {
        boolean result = false;
        SchemaBrowser browser = _tool.getSchemaBrowser();

        // get the expected type of the isQueue column
        Table table = SchemaHelper.getTable(schema, DESTINATIONS_TABLE);
        Attribute column = SchemaHelper.getAttribute(table, ISQUEUE_COLUMN);
        Type expected = browser.getType(column);

        // get the actual type of the isQueue column
        try {
            Table currentTable = browser.getTable(DESTINATIONS_TABLE);
            Attribute currentColumn =
                SchemaHelper.getAttribute(currentTable, ISQUEUE_COLUMN);
            Type currentType = browser.getType(currentColumn);
            result = (currentType.getType() != expected.getType());
        } catch (InvalidTypeException exception) {
            // this will only occur if the JDBC driver is buggy (its amazing
            // home many are - MM.MySQL 2.0.x and Oracle are 2 examples)
            // Try and perform a conversion anyway - and hope for the best...
            _log.warn(exception);
            result = true;
        }
        return result;
    }

    private void doConvert(Database schema) throws PersistenceException {
        Table table = SchemaHelper.getTable(schema, DESTINATIONS_TABLE);

        // create a temporary table to perform conversion
        Table tmpTable = new Table();
        String tmpName = "openjms_tmp_" + DESTINATIONS_TABLE;
        tmpTable.setName(tmpName);
        tmpTable.setAttribute(table.getAttribute());

        _tool.drop(tmpTable);
        _tool.create(tmpTable);

        // convert the destinations table, inserting converted records into
        // the temporary table
        PreparedStatement select = null;
        ResultSet set = null;
        try {
            select = _connection.prepareStatement(
                "select * from " + DESTINATIONS_TABLE);
            set = select.executeQuery();
            while (set.next()) {
                String name = set.getString(1);
                boolean isQueue = (set.getInt(2) > 0);
                long id = set.getLong(3);
                insert(tmpName, name, isQueue, id);
            }
        } catch (SQLException exception) {
            throw new PersistenceException("Failed to convert destinations",
                exception);
        } finally {
            SQLHelper.close(set);
            SQLHelper.close(select);
        }

        // recreate the destinations table
        _tool.drop(table);
        _tool.create(table);

        // copy the data from the temporary table into the destinations table
        PreparedStatement insert = null;
        try {
            insert = _connection.prepareStatement(
                "insert into " + DESTINATIONS_TABLE + " select * from " +
                tmpName);
            insert.executeQuery();
        } catch (SQLException exception) {
            throw new PersistenceException(
                "Failed to copy converted destinations", exception);
        } finally {
            SQLHelper.close(insert);
        }

        // drop the temporary table
        _tool.drop(tmpTable);
    }

    private void insert(String table, String name, boolean isQueue, long id)
        throws SQLException {
        PreparedStatement insert = _connection.prepareStatement(
            "insert into " + table + " values (?, ?, ?)");
        insert.setString(1, name);
        insert.setBoolean(2, isQueue);
        insert.setLong(3, id);
        insert.executeUpdate();
    }


} //-- V061toV072SchemaConverter

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人午夜片在线观看高清观看| 蜜桃av噜噜一区二区三区小说| 五月婷婷另类国产| 国产精品羞羞答答xxdd| 欧美在线视频日韩| 国产日韩一级二级三级| 日韩高清电影一区| 色中色一区二区| 久久久99久久| 91视频国产资源| 欧美成人a在线| 丝袜亚洲另类欧美| 色婷婷激情久久| 国产精品女主播在线观看| 免费的成人av| 91麻豆精品91久久久久久清纯 | 制服丝袜国产精品| 国产精品国产三级国产普通话99| 精品一区二区三区免费视频| 欧美日韩一区二区三区视频| 亚洲欧洲日产国码二区| 丁香亚洲综合激情啪啪综合| 日韩一区二区三区视频| 日韩成人一区二区三区在线观看| 欧美性受xxxx| 伊人开心综合网| 色婷婷一区二区三区四区| 中文字幕在线不卡一区二区三区| 国产黄色精品网站| 久久久久久久久久久久久夜| 国产麻豆成人传媒免费观看| 26uuu国产电影一区二区| 日本免费新一区视频| 欧美精选午夜久久久乱码6080| 亚洲自拍另类综合| 欧美精品丝袜久久久中文字幕| 亚洲在线一区二区三区| 欧美日韩精品一区二区三区四区 | 26uuu另类欧美亚洲曰本| 青青草视频一区| 欧美成人官网二区| 国产精品一卡二卡在线观看| 国产亚洲视频系列| 99久久精品国产一区二区三区 | 成人性生交大片免费看在线播放 | 久久国产精品99精品国产| 欧美一区二区人人喊爽| 麻豆成人91精品二区三区| 精品电影一区二区三区| 大桥未久av一区二区三区中文| 国产日韩视频一区二区三区| av动漫一区二区| 亚洲成av人片一区二区| 精品精品国产高清一毛片一天堂| 国产精品456| 亚洲精品久久嫩草网站秘色| 欧美日韩国产综合久久| 国产资源在线一区| 中文字幕在线不卡一区二区三区| 在线免费精品视频| 麻豆国产欧美日韩综合精品二区| 久久九九影视网| 色婷婷综合激情| 狠狠色狠狠色合久久伊人| 奇米精品一区二区三区四区| 精品美女一区二区三区| 99久久精品国产麻豆演员表| 日韩高清在线电影| 国产免费久久精品| 欧美美女bb生活片| 国产在线一区观看| 亚洲一区二区三区小说| 精品日韩欧美在线| 91成人国产精品| 国产自产2019最新不卡| 亚洲最新视频在线观看| 久久久不卡网国产精品二区| 欧美曰成人黄网| 丁香桃色午夜亚洲一区二区三区| 亚洲第一福利一区| 国产精品美女久久久久久久久久久 | 国产精品久久久久久福利一牛影视| 在线观看一区二区精品视频| 精品亚洲成av人在线观看| 亚洲综合免费观看高清完整版在线| 精品91自产拍在线观看一区| 欧美网站一区二区| 高清不卡在线观看av| 免费成人美女在线观看| 亚洲欧美一区二区久久| 久久久久久一级片| 欧美一区二区三区的| 欧美在线观看视频一区二区| 成人久久视频在线观看| 久久成人麻豆午夜电影| 亚洲国产日韩a在线播放性色| 国产精品热久久久久夜色精品三区| 91精品国产91综合久久蜜臀| 欧美综合一区二区三区| jvid福利写真一区二区三区| 国产乱人伦精品一区二区在线观看 | 色香色香欲天天天影视综合网| 国产乱对白刺激视频不卡| 另类人妖一区二区av| 日本系列欧美系列| 亚洲成人黄色小说| 亚洲午夜免费电影| 亚洲激情一二三区| 亚洲人成小说网站色在线| 欧美国产禁国产网站cc| 国产日本欧洲亚洲| 国产日韩欧美在线一区| 久久精品视频免费观看| 久久色在线视频| 久久嫩草精品久久久久| 久久久久国产精品厨房| 久久久影院官网| 欧美韩国一区二区| 国产精品国产三级国产aⅴ无密码| 国产亚洲精品资源在线26u| 久久这里只精品最新地址| 久久嫩草精品久久久精品| 久久精品亚洲麻豆av一区二区| 久久久亚洲精品石原莉奈 | 久草在线在线精品观看| 美女视频网站久久| 国内成人自拍视频| 粉嫩av一区二区三区| 丰满亚洲少妇av| 91麻豆自制传媒国产之光| 在线观看国产日韩| 91精品国产综合久久久蜜臀粉嫩 | 99精品国产视频| 色八戒一区二区三区| 欧洲另类一二三四区| 91精品国产综合久久久久久漫画| 日韩精品综合一本久道在线视频| 久久综合丝袜日本网| 国产精品美女久久久久高潮| 亚洲综合在线观看视频| 琪琪一区二区三区| 成人午夜视频福利| 欧洲一区在线电影| 欧美一区二区久久| 国产精品污网站| 亚洲香蕉伊在人在线观| 久久精品二区亚洲w码| 成人综合在线观看| 欧美色图片你懂的| 精品国产乱码久久久久久闺蜜| 国产精品毛片a∨一区二区三区| 亚洲国产综合在线| 国产精品正在播放| 欧美视频一区二区三区四区| 精品国产露脸精彩对白| 一二三区精品视频| 国产真实乱偷精品视频免| 色婷婷激情一区二区三区| 26uuu国产在线精品一区二区| 亚洲美女在线国产| 国产精品123| 欧美一级欧美三级| 亚洲免费av在线| 国产福利电影一区二区三区| 欧美视频在线一区| 亚洲欧洲日韩女同| 韩国欧美国产1区| 精品视频在线看| 国产精品成人免费| 国内精品在线播放| 5858s免费视频成人| 亚洲女女做受ⅹxx高潮| 九色|91porny| 91精品国产综合久久精品| 亚洲欧美日韩系列| 国产精品996| 欧美xxx久久| 日韩二区三区在线观看| 日本高清成人免费播放| 中文字幕的久久| 狠狠久久亚洲欧美| 日韩欧美一级二级三级久久久| 亚洲最大成人综合| 色综合一个色综合亚洲| 国产女人水真多18毛片18精品视频| 青青草伊人久久| 欧美一区二视频| 日日欢夜夜爽一区| 日韩精品中文字幕一区| 日本欧美一区二区在线观看| 欧美性大战xxxxx久久久| 亚洲人成精品久久久久| 福利一区福利二区| 久久久久久久久久久黄色| 美女一区二区久久| 日韩精品最新网址| 韩日精品视频一区| 国产亚洲精品资源在线26u| 国产一区二区不卡| 国产情人综合久久777777|