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

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

?? jdbccategorydataset.java

?? jfreechart1.0.1 jsp繪制圖表的開發包
?? JAVA
字號:
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 *
 * This library is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by 
 * the Free Software Foundation; either version 2.1 of the License, or 
 * (at your option) any later version.
 *
 * This library 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 Lesser General Public 
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
 * USA.  
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
 * in the United States and other countries.]
 *
 * ------------------------
 * JDBCCategoryDataset.java
 * ------------------------
 * (C) Copyright 2002-2005, by Bryan Scott and Contributors.
 *
 * Original Author:  Bryan Scott; Andy;
 * Contributor(s):   David Gilbert (for Object Refinery Limited);
 *                   Thomas Morgner;
 *
 * Changes
 * -------
 * 26-Apr-2002 : Creation based on JdbcXYDataSet, using code contributed from 
 *               Andy;
 * 13-Aug-2002 : Updated Javadocs, import statements and formatting (DG);
 * 03-Sep-2002 : Added fix for bug 591385 (DG);
 * 18-Sep-2002 : Updated to support BIGINT (BS);
 * 16-Oct-2002 : Added fix for bug 586667 (DG);
 * 03-Feb-2003 : Added Types.DECIMAL (see bug report 677814) (DG);
 * 13-Jun-2003 : Added Types.TIME as suggest by Bryan Scott in the forum (DG);
 * 30-Jun-2003 : CVS Write test (BS);
 * 30-Jul-2003 : Added empty contructor and executeQuery(connection,string) 
 *               method (BS);
 * 29-Aug-2003 : Added a 'transpose' flag, so that data can be easily 
 *               transposed if required (DG);
 * 10-Sep-2003 : Added support for additional JDBC types (DG);
 * 24-Sep-2003 : Added clearing results from previous queries to executeQuery
 *               following being highlighted on online forum (BS);
 * 02-Dec-2003 : Throwing exceptions allows to handle errors, removed default 
 *               constructor, as without a connection, a query can never be 
 *               executed (TM);
 * 04-Dec-2003 : Added missing Javadocs (DG);
 *
 */

package org.jfree.data.jdbc;

import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;

import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;

/**
 * A {@link CategoryDataset} implementation over a database JDBC result set.
 * The dataset is populated via a call to executeQuery with the string sql
 * query.
 * The sql query must return at least two columns.  The first column will be
 * the category name and remaining columns values.
 * executeQuery can be called a number of times.
 * <p>
 * The database connection is read-only and no write back facility exists.
 */
public class JDBCCategoryDataset extends DefaultCategoryDataset {

    /** The database connection. */
    private transient Connection connection;

    /**
     * A flag the controls whether or not the table is transposed.  The default 
     * is 'true' because this provides the behaviour described in the 
     * documentation.
     */
    private boolean transpose = true;


    /**
     * Creates a new dataset with a database connection.
     *
     * @param  url  the URL of the database connection.
     * @param  driverName  the database driver class name.
     * @param  user  the database user.
     * @param  passwd  the database user's password.
     * 
     * @throws ClassNotFoundException if the driver cannot be found.
     * @throws SQLException if there is an error obtaining a connection to the 
     *                      database.
     */
    public JDBCCategoryDataset(String url,
                               String driverName,
                               String user,
                               String passwd)
        throws ClassNotFoundException, SQLException {

        Class.forName(driverName);
        this.connection = DriverManager.getConnection(url, user, passwd);
    }

    /**
     * Create a new dataset with the given database connection.
     *
     * @param connection  the database connection.
     */
    public JDBCCategoryDataset(Connection connection) {
        if (connection == null) {
            throw new NullPointerException("A connection must be supplied.");
        }
        this.connection = connection;
    }

    /**
     * Creates a new dataset with the given database connection, and executes 
     * the supplied query to populate the dataset.
     *
     * @param connection  the connection.
     * @param query  the query.
     * 
     * @throws SQLException if there is a problem executing the query.
     */
    public JDBCCategoryDataset(Connection connection, String query) 
        throws SQLException {
        this(connection);
        executeQuery(query);
    }

    /**
     * Returns a flag that controls whether or not the table values are 
     * transposed when added to the dataset.
     *
     * @return A boolean.
     */
    public boolean getTranspose() {
        return this.transpose;
    }

    /**
     * Sets a flag that controls whether or not the table values are transposed
     * when added to the dataset.
     *
     * @param transpose  the flag.
     */
    public void setTranspose(boolean transpose) {
        this.transpose = transpose;
    }

    /**
     * Populates the dataset by executing the supplied query against the 
     * existing database connection.  If no connection exists then no action 
     * is taken.
     * <p>
     * The results from the query are extracted and cached locally, thus 
     * applying an upper limit on how many rows can be retrieved successfully.
     *
     * @param query  the query.
     * 
     * @throws SQLException if there is a problem executing the query.
     */
    public void executeQuery(String query) throws SQLException {
        executeQuery(this.connection, query);
    }

    /**
     * Populates the dataset by executing the supplied query against the 
     * existing database connection.  If no connection exists then no action 
     * is taken.
     * <p>
     * The results from the query are extracted and cached locally, thus 
     * applying an upper limit on how many rows can be retrieved successfully.
     *
     * @param con  the connection.
     * @param query  the query.
     * 
     * @throws SQLException if there is a problem executing the query.
     */
    public void executeQuery(Connection con, String query) throws SQLException {

        Statement statement = null;
        ResultSet resultSet = null;
        try {
            statement = con.createStatement();
            resultSet = statement.executeQuery(query);
            ResultSetMetaData metaData = resultSet.getMetaData();

            int columnCount = metaData.getColumnCount();

            if (columnCount < 2) {
                throw new SQLException(
                    "JDBCCategoryDataset.executeQuery() : insufficient columns "
                    + "returned from the database.");
            }

            // Remove any previous old data
            int i = getRowCount();
            for (; i > 0; --i) {
                removeRow(i);
            }

            while (resultSet.next()) {
                // first column contains the row key...
                Comparable rowKey = resultSet.getString(1);
                for (int column = 2; column <= columnCount; column++) {

                    Comparable columnKey = metaData.getColumnName(column);
                    int columnType = metaData.getColumnType(column);

                    switch (columnType) {
                        case Types.TINYINT:
                        case Types.SMALLINT:
                        case Types.INTEGER:
                        case Types.BIGINT:
                        case Types.FLOAT:
                        case Types.DOUBLE:
                        case Types.DECIMAL:
                        case Types.NUMERIC:
                        case Types.REAL: {
                            Number value = (Number) resultSet.getObject(column);
                            if (this.transpose) {
                                setValue(value, columnKey, rowKey);
                            }
                            else {
                                setValue(value, rowKey, columnKey);
                            }
                            break;
                        }
                        case Types.DATE:
                        case Types.TIME:
                        case Types.TIMESTAMP: {
                            Date date = (Date) resultSet.getObject(column);
                            Number value = new Long(date.getTime());
                            if (this.transpose) {
                                setValue(value, columnKey, rowKey);
                            }
                            else {
                                setValue(value, rowKey, columnKey);
                            }
                            break;
                        }
                        case Types.CHAR:
                        case Types.VARCHAR:
                        case Types.LONGVARCHAR: {
                            String string 
                                = (String) resultSet.getObject(column);
                            try {
                                Number value = Double.valueOf(string);
                                if (this.transpose) {
                                    setValue(value, columnKey, rowKey);
                                }
                                else {
                                    setValue(value, rowKey, columnKey);
                                }
                            }
                            catch (NumberFormatException e) {
                                // suppress (value defaults to null)
                            }
                            break;
                        }
                        default:
                            // not a value, can't use it (defaults to null)
                            break;
                    }
                }
            }

            fireDatasetChanged();
        }
        finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                }
                catch (Exception e) {
                    // report this?
                }
            }
            if (statement != null) {
                try {
                    statement.close();
                }
                catch (Exception e) {
                    // report this?
                }
            }
        }
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91.com视频| 亚洲少妇最新在线视频| 国产嫩草影院久久久久| 日韩一区在线免费观看| 天天av天天翘天天综合网色鬼国产| 国内一区二区视频| 欧美精品色一区二区三区| 国产亚洲精品免费| 日韩在线播放一区二区| 91丨国产丨九色丨pron| 亚洲精品在线三区| 亚洲成人www| 91蝌蚪porny成人天涯| 国产日韩欧美精品一区| 蜜臀久久99精品久久久久久9| 91麻豆精品一区二区三区| 久久久久9999亚洲精品| 美女视频黄免费的久久| 欧美精品18+| 亚欧色一区w666天堂| 91福利在线免费观看| 日韩美女视频一区| 99精品欧美一区二区三区综合在线| 精品对白一区国产伦| 蜜桃久久精品一区二区| 在线播放中文一区| 午夜精品一区二区三区免费视频 | 青草国产精品久久久久久| 在线视频观看一区| 一区二区三区免费观看| 91亚洲资源网| 一区二区三区日韩在线观看| 色综合色狠狠综合色| 亚洲图片另类小说| 欧美在线观看你懂的| 亚洲激情男女视频| 欧美日韩中字一区| 午夜精品在线看| 日韩欧美一区二区三区在线| 免费xxxx性欧美18vr| 欧美成人综合网站| 国产精品 欧美精品| 国产欧美久久久精品影院| 国产福利一区二区三区视频在线 | 国产成人精品免费网站| 国产校园另类小说区| 从欧美一区二区三区| 国产精品不卡在线| 91视频观看免费| 日韩福利电影在线| 久久久影院官网| 91色porny| 日本美女一区二区| 久久久精品蜜桃| 91天堂素人约啪| 日韩av一区二| 国产精品午夜久久| 日本丶国产丶欧美色综合| 天堂av在线一区| 2020日本不卡一区二区视频| caoporen国产精品视频| 午夜视频久久久久久| 久久一夜天堂av一区二区三区| 成人av动漫在线| 亚洲v日本v欧美v久久精品| 26uuu精品一区二区三区四区在线| www.av亚洲| 日本中文字幕不卡| 国产精品视频一区二区三区不卡| 欧美在线观看禁18| 国产.欧美.日韩| 亚洲午夜精品一区二区三区他趣| 久久这里只精品最新地址| 99精品视频在线观看免费| 免费人成精品欧美精品| 国产精品剧情在线亚洲| 67194成人在线观看| 成人av资源在线| 久久国产免费看| 亚洲男人电影天堂| 久久精品亚洲乱码伦伦中文| 欧美色综合天天久久综合精品| 国产精品一区二区久久精品爱涩| 亚洲图片欧美综合| 国产精品毛片高清在线完整版| 欧美精品日韩一区| 欧洲av一区二区嗯嗯嗯啊| 高清国产一区二区| 毛片av中文字幕一区二区| 亚洲高清免费观看| 亚洲私人黄色宅男| 久久精品欧美一区二区三区麻豆| 在线不卡一区二区| 欧美性色黄大片| 91老师国产黑色丝袜在线| 国产成人精品亚洲777人妖| 看片网站欧美日韩| 首页欧美精品中文字幕| 亚洲一区二区视频在线观看| 亚洲欧洲成人精品av97| 国产丝袜欧美中文另类| 精品少妇一区二区三区日产乱码| 欧美日韩一区在线观看| 在线一区二区三区| 99久久免费国产| 不卡的av网站| 成人性视频免费网站| 韩国三级电影一区二区| 另类中文字幕网| 精品一区二区三区在线播放 | 91精品中文字幕一区二区三区| 91麻豆swag| 91欧美一区二区| 在线亚洲欧美专区二区| 欧洲一区二区三区在线| 欧美三级资源在线| 欧美日韩国产精选| 欧美三区在线观看| 7777精品伊人久久久大香线蕉完整版| 在线观看日韩国产| 欧美三级日韩在线| 91麻豆精品国产91久久久| 日韩欧美一区在线| 欧美精品一区视频| 国产亚洲婷婷免费| 国产精品久久精品日日| 中文字幕中文在线不卡住| 亚洲日本va午夜在线影院| 亚洲综合一二三区| 日韩成人精品在线观看| 捆绑紧缚一区二区三区视频| 国产精品一级片| 99re6这里只有精品视频在线观看| 99re在线精品| 欧美乱妇23p| 久久这里只有精品视频网| 国产精品麻豆网站| 亚洲一区二区三区四区五区黄 | 国产一区二区在线观看免费| 国产精品中文字幕一区二区三区| 懂色中文一区二区在线播放| 99re在线视频这里只有精品| 欧美日本乱大交xxxxx| 亚洲精品在线网站| 一区二区三区久久| 久久精品国产网站| 99精品在线观看视频| 91精品欧美久久久久久动漫| 精品99999| 一区二区三区中文字幕精品精品| 日本视频一区二区三区| 成人性生交大片| 欧美日韩国产高清一区二区三区| 久久久久久久国产精品影院| 一区二区三区日韩| 高清不卡一二三区| 欧美日韩另类国产亚洲欧美一级| 久久久久高清精品| 日韩国产一区二| 不卡一区二区三区四区| 91精品国产福利| 久久影院午夜片一区| 丝袜亚洲另类欧美综合| 99久久亚洲一区二区三区青草 | 裸体健美xxxx欧美裸体表演| 成人av影院在线| 日韩午夜小视频| 一区二区三区成人| 国产99久久久久| 欧美卡1卡2卡| 一区二区三区精品久久久| 国产成人av电影在线播放| 91精品国产综合久久久久| 亚洲欧美日韩国产综合在线| 精品一区二区成人精品| 欧美日韩午夜在线| 亚洲激情自拍视频| thepron国产精品| 久久久不卡网国产精品一区| 丝袜诱惑亚洲看片| www.欧美亚洲| 久久精品网站免费观看| 另类欧美日韩国产在线| 欧美日韩一区成人| 夜夜嗨av一区二区三区中文字幕| 粉嫩蜜臀av国产精品网站| 精品日韩欧美在线| 调教+趴+乳夹+国产+精品| 在线一区二区三区做爰视频网站| 中文字幕日韩一区| 不卡的av网站| 中文字幕亚洲欧美在线不卡| 成人激情视频网站| 国产精品欧美综合在线| 国产高清不卡二三区| 久久精品亚洲精品国产欧美| 国产九色精品成人porny| 日韩精品一区二区三区swag | 首页欧美精品中文字幕| 欧美色老头old∨ideo|