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

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

?? schemabrowser.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 2002-2003 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: SchemaBrowser.java,v 1.1 2004/11/26 01:51:15 tanderson Exp $
 */

package org.exolab.jms.tools.db;

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

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 methods for examining a database schema
 *
 * @version     $Revision: 1.1 $ $Date: 2004/11/26 01:51:15 $
 * @author      <a href="mailto:tima@intalio.com">Tim Anderson</a>
 */
public class SchemaBrowser {

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

    /**
     * The set of data types supported by the RDBMS
     */
    private TypeSet _types = null;

    /**
     * The type mapper, used to convert between the type requested by
     * the schema, and those supported by the RDBMS
     */
    private TypeMapper _mapper = null;

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


    /**
     * Construct a new <code>SchemaBrowser</code>
     *
     * @param connection the JDBC connection
     * @throws PersistenceException if database meta-data can't be obtained
     */
    public SchemaBrowser(Connection connection) throws PersistenceException {
        _connection = connection;

        // get the types supported by the database
        _types = new TypeSet(_connection);
        _mapper = new TypeMapper(_types);
    }

    /**
     * Returns the schema for the specified table
     *
     * @param name the table name
     * @return the schema for the table identified by <code>name</code>
     * @throws PersistenceException if the named table doesn't exist, or the
     * schema cannot be obtained
     */
    public Table getTable(String name) throws PersistenceException {
        Table result = new Table();

        result.setName(name);

        // determine the column types. Another approach would be to use
        // DatabaseMetaData.getColumns() - except that not all JDBC drivers
        // seem to support this (e.g, Sybase)
        PreparedStatement select = null;
        try {
            select = _connection.prepareStatement(
                "select * from " + name + " where 1 = 0");
            ResultSet set = select.executeQuery();
            ResultSetMetaData metaData = set.getMetaData();

            for (int i = 1; i <= metaData.getColumnCount(); ++i) {
                String columnName = metaData.getColumnName(i);
                int dataType = metaData.getColumnType(i);
                long precision = metaData.getPrecision(i);
                int nullable = metaData.isNullable(i);
                String typeName = metaData.getColumnTypeName(i);
                Type type = _mapper.getType(dataType, precision);
                if (type == null) {
                    // this will only occur if the JDBC driver is buggy, as the
                    // database meta data is inconsistent with the column meta
                    // data
                    // Try and get the nearest precision equivalent
                    type = _types.getNearestType(dataType, precision);
                    if (type == null) {
                        // getColumns() refers to type not included in
                        // database meta data
                        throw new InvalidTypeException(
                            "JDBC driver error. Type=" + dataType
                            + ", precision=" + precision + "(SQL type="
                            + typeName + ") isn't supported by "
                            + "Connection.getMetaData().getTypeInfo(), but is "
                            + "referred to by "
                            + "Connection.getMetaData().getColumns()");
                    }
                }

                Attribute attribute = new Attribute();
                attribute.setName(columnName);
                attribute.setType(type.getSymbolicType());
                if (nullable == DatabaseMetaData.columnNoNulls) {
                    attribute.setNot_null(true);
                } else {
                    attribute.setNot_null(false);
                }
                result.addAttribute(attribute);
            }
        } catch (SQLException exception) {
            throw new PersistenceException(
                "Failed to determine the schema of table=" + name,
                exception);
        } finally {
            SQLHelper.close(select);
        }
        return result;
    }

    /**
     * Returns the {@link Type} for an {@link Attribute}
     *
     * @param attribute the attribute
     * @return the type
     * @throws PersistenceException if {@link Attribute#getType} is invalid, or
     * the RDBMS doesn't support the type
     */
    public Type getType(Attribute attribute) throws PersistenceException {
        Type result = null;
        Type type = Type.getType(attribute.getType());
        Type map = _mapper.getType(type.getType(), type.getPrecision());
        if (map == null) {
            throw new PersistenceException(
                "Database does not support type=" + attribute.getType());
        }

        if (type.getType() != map.getType()) {
            result = map;
        } else {
            boolean parameters = type.getParameters();
            long precision = type.getPrecision();
            if (precision <= map.getPrecision()) {
                if (precision == -1) {
                    precision = map.getPrecision();
                    parameters = map.getParameters();
                }
                result = new Type(map.getType(), map.getName(),
                    precision, parameters);
            } else {
                throw new PersistenceException(
                    attribute.getName() + type + " exceeds precision for "
                    + map + " precision=" + map.getPrecision());
            }
        }
        return result;
    }

    /**
     * Returns true if a table exists
     *
     * @param table the name of the table
     */
    public boolean getTableExists(String table) throws PersistenceException {
        boolean result = false;

        String name = table;
        ResultSet set = null;
        try {
            DatabaseMetaData metaData = _connection.getMetaData();
            if (metaData.storesUpperCaseIdentifiers()) {
                name = name.toUpperCase();
            }

            set = metaData.getTables(_connection.getCatalog(), null,
                name, null);
            if (set.next()) {
                result = true;
            }
        } catch (SQLException exception) {
            throw new PersistenceException("Failed to determine if table="
                + table + " exists", exception);
        } finally {
            SQLHelper.close(set);
        }
        return result;
    }

} //-- SchemaBrowser

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av亚洲精华国产精华| 亚洲国产精品一区二区久久 | 欧美视频精品在线观看| 国产精品入口麻豆九色| 91麻豆国产自产在线观看| 亚洲欧洲中文日韩久久av乱码| 色综合中文综合网| 亚洲精品亚洲人成人网在线播放| 91丨国产丨九色丨pron| 亚洲夂夂婷婷色拍ww47| 欧美高清www午色夜在线视频| 日韩激情在线观看| 亚洲精品在线三区| 成+人+亚洲+综合天堂| 亚洲一本大道在线| 日韩欧美www| 成人国产精品免费观看| 亚洲午夜久久久久久久久电影院 | 欧美一区二区福利在线| 精品亚洲欧美一区| 国产精品三级av| 欧美三级电影在线看| 久久国产福利国产秒拍| 国产精品毛片大码女人| 欧美日韩高清影院| 国产精品99久久久久| 一区二区三区在线视频免费| 欧美成人a视频| 91丨porny丨蝌蚪视频| 蜜桃一区二区三区在线| 中文字幕av一区二区三区| 精品视频在线视频| 国产成人无遮挡在线视频| 亚洲一区二区三区不卡国产欧美| 久久丝袜美腿综合| 欧美视频一区在线观看| 国产在线国偷精品产拍免费yy| 亚洲私人影院在线观看| 欧美精品一区二区久久久| 91视频在线观看| 激情文学综合丁香| 亚洲一区二区av电影| 国产女人18水真多18精品一级做| 欧美美女喷水视频| 91丨九色丨尤物| 国产精品白丝jk黑袜喷水| 日日摸夜夜添夜夜添亚洲女人| 欧美国产日产图区| www激情久久| 51久久夜色精品国产麻豆| 色婷婷激情综合| 成人精品视频一区| 国产专区欧美精品| 日本欧美在线看| 亚洲高清视频中文字幕| 最新国产精品久久精品| 久久精品无码一区二区三区| 欧美一区二区三区性视频| 欧美性大战久久久久久久蜜臀| 成人v精品蜜桃久久一区| 国产伦精品一区二区三区免费| 日韩高清不卡在线| 亚洲成人综合在线| 亚洲欧美综合在线精品| 中文av一区二区| 国产日产欧产精品推荐色| 精品国产免费人成在线观看| 欧美一区二区三区视频| 欧美高清视频在线高清观看mv色露露十八 | 欧美一级专区免费大片| 欧美日韩精品一区二区天天拍小说 | 亚洲区小说区图片区qvod| 国产精品剧情在线亚洲| 国产亚洲短视频| 久久久不卡影院| 国产日韩欧美麻豆| 久久精品亚洲麻豆av一区二区| 久久丝袜美腿综合| 久久精品视频一区二区| 久久久亚洲精品石原莉奈 | 国产一区二区伦理| 国产精品自拍三区| 国产99久久久国产精品潘金| 国产成人免费视| 成人三级伦理片| 99九九99九九九视频精品| 91视频你懂的| 欧美在线色视频| 欧美男生操女生| 日韩欧美亚洲国产精品字幕久久久| 欧美一区二区在线免费播放| 欧美成人伊人久久综合网| 精品久久一二三区| 欧美极品少妇xxxxⅹ高跟鞋 | 日韩欧美高清dvd碟片| 精品国产91亚洲一区二区三区婷婷| 久久久一区二区三区| 中文字幕一区二区三区av| 亚洲自拍与偷拍| 久久99久久99小草精品免视看| 国产精品主播直播| 色综合久久综合| 欧美理论在线播放| 久久婷婷综合激情| 亚洲欧美偷拍三级| 日日欢夜夜爽一区| 国内精品视频一区二区三区八戒| 懂色av噜噜一区二区三区av| 一本到高清视频免费精品| 91精品福利在线一区二区三区| 久久久久久久一区| 一区二区三区日韩精品| 久久精品国产一区二区| 成人黄色大片在线观看| 欧洲一区二区三区免费视频| 精品国内二区三区| 亚洲免费高清视频在线| 另类的小说在线视频另类成人小视频在线 | 久久99精品久久久久久久久久久久| 高清成人免费视频| 欧美日韩国产大片| 中文字幕成人在线观看| 日日夜夜精品免费视频| 成人精品亚洲人成在线| 欧美一区二区三区视频免费| 亚洲欧洲在线观看av| 久久99精品久久只有精品| 91免费观看视频| 亚洲精品一区二区三区四区高清| 亚洲综合在线视频| 国产suv精品一区二区6| 777精品伊人久久久久大香线蕉| 国产女同性恋一区二区| 免费观看在线综合色| 色综合久久久久| 欧美激情一区在线观看| 蜜臀久久99精品久久久画质超高清 | 日韩免费看的电影| 一区二区三区在线免费播放| 国产综合成人久久大片91| 欧美视频日韩视频| 国产精品久久久久久久蜜臀| 黄色日韩网站视频| 欧美猛男男办公室激情| 亚洲欧洲精品成人久久奇米网| 精品亚洲免费视频| 4438x成人网最大色成网站| 亚洲女性喷水在线观看一区| 福利电影一区二区三区| 精品少妇一区二区三区免费观看 | 成人免费小视频| 国产传媒一区在线| 欧美tickling网站挠脚心| 午夜欧美在线一二页| 91捆绑美女网站| 亚洲欧美怡红院| 国产.精品.日韩.另类.中文.在线.播放| 欧美一区二区三区啪啪| 亚洲成a天堂v人片| 欧美性色欧美a在线播放| 亚洲免费成人av| 色狠狠一区二区| 亚洲免费在线看| 色88888久久久久久影院按摩| 亚洲欧洲精品成人久久奇米网| 粉嫩一区二区三区在线看| 国产欧美综合在线| 成人免费毛片app| 国产精品青草综合久久久久99| 国产成人综合自拍| 亚洲欧洲av在线| 色综合网色综合| 一区二区激情视频| 9191久久久久久久久久久| 日韩电影在线免费看| 欧美一卡二卡三卡四卡| 久久草av在线| 国产视频视频一区| www.欧美.com| 亚洲高清一区二区三区| 欧美精品色一区二区三区| 麻豆精品一区二区av白丝在线| 精品国内二区三区| 成人一区二区三区视频| 一区二区在线观看视频在线观看| 欧美在线视频全部完| 免费在线观看日韩欧美| 久久这里只有精品视频网| av在线播放成人| 亚洲一区在线观看视频| 欧美一级欧美三级| 国产激情一区二区三区桃花岛亚洲| 国产精品另类一区| 欧美美女bb生活片| 国产在线播精品第三| 1024国产精品| 777欧美精品| 成人avav在线| 偷窥国产亚洲免费视频| 国产夜色精品一区二区av|