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

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

?? v072tov076schemaconverter.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 2003 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: V072toV076SchemaConverter.java,v 1.1 2004/11/26 01:51:16 tanderson Exp $
 */
package org.exolab.jms.tools.db.migration;

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

import org.exolab.jms.persistence.PersistenceException;
import org.exolab.jms.persistence.SQLHelper;
import org.exolab.jms.tools.db.Database;
import org.exolab.jms.tools.db.RDBMSTool;
import org.exolab.jms.tools.db.SchemaConverter;
import org.exolab.jms.tools.db.SchemaHelper;
import org.exolab.jms.tools.db.Table;


/**
 * A schema converter for converting from the 0.7.2 schema to the 0.7.6 schema
 *
 * @version     $Revision: 1.1 $ $Date: 2004/11/26 01:51:16 $
 * @author      <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 */
public class V072toV076SchemaConverter implements SchemaConverter {

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

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

    /**
     * The name of the users table
     */
    private static final String USERS_TABLE = "users";

    /**
     * The name of the messages table
     */
    private static final String MESSAGES_TABLE = "messages";

    /**
     * The name of the handles table
     */
    private static final String HANDLES_TABLE = "message_handles";


    /**
     * Construct a new <code>V072toV076SchemaConverter</code>
     *
     * @param connection the connection to use
     */
    public V072toV076SchemaConverter(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 {
            convertMessagesTable(schema);
            convertHandlesTable(schema);
            createUsersTable(schema);
            SchemaHelper.setVersion(_connection, "V0.7.6");
            _connection.commit();
        } catch (PersistenceException exception) {
            SQLHelper.rollback(_connection);
            throw exception;
        } catch (SQLException exception) {
            SQLHelper.rollback(_connection);
            throw new PersistenceException(exception);
        }
    }

    /**
     * Converts the message identifier columns from long to string
     */
    private void convertMessagesTable(Database schema)
        throws PersistenceException, SQLException {
        Table table = SchemaHelper.getTable(schema, MESSAGES_TABLE);

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

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

        // convert the messages table, inserting converted records into
        // the temporary table
        PreparedStatement select = _connection.prepareStatement(
            "select messageid, destinationid, priority, createTime,"
            + "expiryTime, processed, messageBlob from " + MESSAGES_TABLE);
        ResultSet set = select.executeQuery();
        while (set.next()) {
            long id = set.getLong(1);
            long destinationId = set.getLong(2);
            int priority = set.getInt(3);
            long createTime = set.getLong(4);
            long expiryTime = set.getLong(5);
            int processed = set.getInt(6);
            byte[] blob = set.getBytes(7);
            String messageId = "ID:" + id;
            migrateMessage(tmpName, messageId, destinationId, priority,
                createTime, expiryTime, processed, blob);
        }
        set.close();
        select.close();

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

        // copy the data from the temporary table into the messages table
        select = _connection.prepareStatement(
            "select messageid, destinationid, priority, createTime,"
            + "expiryTime, processed, messageBlob from " + tmpName);

        set = select.executeQuery();
        while (set.next()) {
            String messageId = set.getString(1);
            long destinationId = set.getLong(2);
            int priority = set.getInt(3);
            long createTime = set.getLong(4);
            long expiryTime = set.getLong(5);
            int processed = set.getInt(6);
            byte[] blob = set.getBytes(7);
            migrateMessage(tmpName, messageId, destinationId, priority,
                createTime, expiryTime, processed, blob);
        }
        set.close();
        select.close();

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

    private void migrateMessage(String table, String messageId,
                                long destinationId, int priority,
                                long createTime, long expiryTime,
                                int processed, byte[] blob)
        throws SQLException {
        PreparedStatement insert = null;
        try {
            // create, populate and execute the insert
            insert = _connection.prepareStatement(
                "insert into " + table + " values (?,?,?,?,?,?,?)");
            insert.setString(1, messageId);
            insert.setLong(2, destinationId);
            insert.setInt(3, priority);
            insert.setLong(4, createTime);
            insert.setLong(5, expiryTime);
            insert.setInt(6, processed);
            insert.setBinaryStream(7, new ByteArrayInputStream(blob),
                blob.length);

            // execute the insert
            if (insert.executeUpdate() != 1) {
                throw new SQLException("Failed to add message=" + messageId);
            }
        } finally {
            SQLHelper.close(insert);
        }
    }

    /**
     * Converts the message identifier columns from long to string
     */
    private void convertHandlesTable(Database schema)
        throws PersistenceException, SQLException {

        Table table = SchemaHelper.getTable(schema, HANDLES_TABLE);

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

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

        // convert the messages_handles table, inserting converted records into
        // the temporary table
        PreparedStatement select = _connection.prepareStatement(
            "select messageid, destinationid, consumerid, priority, "
            + " acceptedTime, sequenceNumber, expiryTime, delivered"
            + " from " + HANDLES_TABLE);
        ResultSet set = select.executeQuery();
        while (set.next()) {
            long messageId = set.getLong(1);
            long destinationId = set.getLong(2);
            long consumerId = set.getLong(3);
            int priority = set.getInt(4);
            long acceptedTime = set.getLong(5);
            long sequenceNo = set.getLong(6);
            long expiryTime = set.getLong(7);
            int delivered = set.getInt(8);
            migrateHandle(tmpName, messageId, destinationId, consumerId,
                priority, acceptedTime, sequenceNo, expiryTime,
                delivered);
        }
        set.close();
        select.close();

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

        // copy the data from the temporary table into the messages table
        select = _connection.prepareStatement(
            "insert into " + HANDLES_TABLE + " select * from " +
            tmpName);
        select.executeQuery();
        select.close();

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

    private void migrateHandle(String table, long messageId,
                               long destinationId, long consumerId,
                               int priority, long acceptedTime,
                               long sequenceNo, long expiryTime,
                               int delivered) throws SQLException {
        PreparedStatement insert = null;
        try {
            // create, populate and execute the insert
            insert = _connection.prepareStatement(
                "insert into " + table + " values (?,?,?,?,?,?,?,?)");
            insert.setString(1, "ID:" + messageId);
            insert.setLong(2, destinationId);
            insert.setLong(3, consumerId);
            insert.setInt(4, priority);
            insert.setLong(5, acceptedTime);
            insert.setLong(6, sequenceNo);
            insert.setLong(7, expiryTime);
            insert.setInt(8, delivered);

            // execute the insert
            if (insert.executeUpdate() != 1) {
                throw new SQLException("Failed to add handle=" + messageId);
            }
        } finally {
            SQLHelper.close(insert);
        }
    }

    private void createUsersTable(Database schema)
        throws PersistenceException {
        Table table = SchemaHelper.getTable(schema, USERS_TABLE);
        _tool.create(table);
    }


} //-- V072toV076SchemaConverter

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美不卡一区二区三区四区| 中文字幕中文在线不卡住| 国产精品原创巨作av| 亚洲一区二区三区精品在线| 国产精品乱码妇女bbbb| 久久久综合激的五月天| 日韩精品一区二区在线| 日韩欧美亚洲国产另类 | 日韩精品中文字幕一区| 欧洲生活片亚洲生活在线观看| 成人av网站免费| 不卡一区二区三区四区| 97se狠狠狠综合亚洲狠狠| 99精品热视频| 在线观看亚洲精品| 欧美亚洲愉拍一区二区| 欧美撒尿777hd撒尿| 欧美精品乱码久久久久久| 欧美一卡二卡在线| 精品国产凹凸成av人导航| 精品福利一区二区三区免费视频| 日韩欧美你懂的| 精品福利一区二区三区| 中文字幕av一区二区三区高 | 日韩精品一区二区三区蜜臀| 日韩色视频在线观看| 2024国产精品| 国产精品电影院| 夜夜揉揉日日人人青青一国产精品| 亚洲精品国产视频| 日韩电影在线观看网站| 国产精品乡下勾搭老头1| 成人性生交大合| 欧美日韩一级视频| 日韩欧美成人激情| 国产精品色在线| 天天综合天天做天天综合| 激情小说欧美图片| 91在线精品秘密一区二区| 欧美丰满嫩嫩电影| 久久精品夜色噜噜亚洲aⅴ| 成人欧美一区二区三区1314| 三级久久三级久久| 国产盗摄精品一区二区三区在线| 色偷偷久久人人79超碰人人澡| 91精品欧美综合在线观看最新| 国产欧美日韩麻豆91| 午夜精品免费在线观看| 国产盗摄视频一区二区三区| 欧美精品久久久久久久多人混战 | 日韩一区二区不卡| 中文字幕欧美三区| 爽好久久久欧美精品| 成人精品在线视频观看| 欧美一区二区免费| 亚洲精品国久久99热| 国产精品综合久久| 51精品秘密在线观看| 亚洲乱码国产乱码精品精98午夜| 久久精工是国产品牌吗| 91伊人久久大香线蕉| 久久久久一区二区三区四区| 日韩黄色免费网站| 在线免费观看视频一区| 欧美经典一区二区三区| 美女任你摸久久| 欧美日韩国产一级片| 亚洲精品一卡二卡| 成人av中文字幕| 国产拍揄自揄精品视频麻豆| 久久97超碰色| 日韩一级完整毛片| 奇米影视一区二区三区| 欧美色精品天天在线观看视频| 亚洲色图色小说| 懂色av一区二区三区蜜臀| 久久网站最新地址| 久久福利视频一区二区| 日韩精品专区在线| 久久精品理论片| 欧美成人一区二区三区片免费| 亚洲va天堂va国产va久| 欧美日韩高清一区二区| 亚洲国产人成综合网站| 欧美午夜视频网站| 亚洲丶国产丶欧美一区二区三区| 欧美午夜在线一二页| 亚洲动漫第一页| 欧美电影影音先锋| 99久久精品情趣| 中文字幕中文在线不卡住| 成人99免费视频| 亚洲精品免费看| 欧美日韩精品高清| 美女视频黄a大片欧美| 日韩一区二区视频| 国产一区二区精品久久99| 2021中文字幕一区亚洲| 成人涩涩免费视频| 亚洲黄色录像片| 777色狠狠一区二区三区| 麻豆精品国产91久久久久久| 久久综合久久99| 99久久国产综合精品色伊| 亚洲精品成人a在线观看| 欧美精品日韩精品| 久久电影网电视剧免费观看| 欧美激情在线观看视频免费| 91美女在线观看| 免费成人在线视频观看| 久久久99免费| 欧美亚洲动漫精品| 老司机精品视频在线| 国产精品久久777777| 欧美日韩一二三| 国产成人亚洲综合a∨婷婷| 亚洲精品中文在线观看| 精品日产卡一卡二卡麻豆| k8久久久一区二区三区| 日日摸夜夜添夜夜添国产精品| 久久久久久亚洲综合影院红桃| 91麻豆视频网站| 久88久久88久久久| 亚洲欧美乱综合| 精品国产一区二区三区忘忧草| av一本久道久久综合久久鬼色| 日韩精品免费专区| 国产精品久久三| 欧美本精品男人aⅴ天堂| 91小宝寻花一区二区三区| 精品一区二区三区不卡| 日本不卡一区二区三区| 亚洲私人影院在线观看| 26uuuu精品一区二区| 精品视频123区在线观看| www.亚洲在线| 国模娜娜一区二区三区| 午夜精品久久久久影视| 亚洲男人电影天堂| 亚洲国产高清在线观看视频| 日韩午夜在线播放| 欧美日本一区二区三区四区| 91亚洲资源网| 成人激情电影免费在线观看| 精品综合久久久久久8888| 污片在线观看一区二区| 亚洲六月丁香色婷婷综合久久| 欧美国产一区视频在线观看| 欧美mv日韩mv| 91精品国产全国免费观看 | 色综合色狠狠天天综合色| 国产成人精品三级| 国产麻豆欧美日韩一区| 久久99精品一区二区三区| 丝袜美腿亚洲一区| 天天综合色天天综合| 亚洲综合色噜噜狠狠| 一区二区三区丝袜| 一区二区三区中文字幕精品精品| 18欧美乱大交hd1984| 中文字幕永久在线不卡| 国产精品蜜臀av| 亚洲欧洲另类国产综合| 亚洲视频一区二区在线观看| 亚洲欧洲精品一区二区三区不卡| 欧美国产97人人爽人人喊| 国产精品日日摸夜夜摸av| 国产精品成人网| 亚洲麻豆国产自偷在线| 一区二区高清在线| 亚洲国产一区二区三区| 亚洲自拍偷拍麻豆| 视频一区二区国产| 麻豆成人久久精品二区三区小说| 激情综合色综合久久综合| 国产精品一二三区| 99久久久久久99| 欧美精品久久一区| 久久久久久久综合| 一区在线中文字幕| 午夜亚洲福利老司机| 免费观看日韩av| 成人精品视频一区二区三区| 色综合久久久久久久久久久| 精品视频在线看| 精品粉嫩超白一线天av| 日韩毛片高清在线播放| 亚洲综合视频网| 国产在线麻豆精品观看| 91在线免费播放| 日韩欧美一级在线播放| 中文一区一区三区高中清不卡| 一区二区三区在线观看动漫| 日本不卡123| 91国在线观看| 欧美一区二区三区在线观看视频| 国产亲近乱来精品视频| 亚洲永久精品大片| 国产真实乱子伦精品视频| 在线免费观看日本欧美|