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

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

?? jdbcxydataset.java

?? jfreechart1.0.1 jsp繪制圖表的開發包
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* ===========================================================
 * 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.]
 *
 * ------------------
 * JDBCXYDataset.java
 * ------------------
 * (C) Copyright 2002-2005, by Bryan Scott and Contributors.
 *
 * Original Author:  Bryan Scott;
 * Contributor(s):   David Gilbert (for Object Refinery Limited);
 *                   Eric Alexander;
 *
 *
 * Changes
 * -------
 * 14-Mar-2002 : Version 1 contributed by Bryan Scott (DG);
 * 19-Apr-2002 : Updated executeQuery, to close cursors and to improve support 
 *               for types.
 * 26-Apr-2002 : Renamed JdbcXYDataset to better fit in with the existing data 
 *               source conventions.
 * 26-Apr-2002 : Changed to extend AbstractDataset.
 * 13-Aug-2002 : Updated Javadoc comments and imports (DG);
 * 18-Sep-2002 : Updated to support BIGINT (BS);
 * 21-Jan-2003 : Renamed JdbcXYDataset --> JDBCXYDataset (DG);
 * 01-Jul-2003 : Added support to query whether a timeseries (BS);
 * 30-Jul-2003 : Added empty contructor and executeQuery(connection,string) 
 *               method (BS);
 * 24-Sep-2003 : Added a check to ensure at least two valid columns are 
 *               returned by the query in executeQuery as suggest in online 
 *               forum by anonymous (BS);
 * 02-Dec-2003 : Throwing exceptions allows to handle errors, removed default 
 *               constructor, as without a connection, a query can never be 
 *               executed.
 * 16-Mar-2004 : Added check for null values (EA);
 * 05-May-2004 : Now extends AbstractXYDataset (DG);
 * 21-May-2004 : Implemented TableXYDataset, added support for SMALLINT and 
 *               fixed bug in code that determines the min and max values (see 
 *               bug id 938138) (DG);
 * 15-Jul-2004 : Switched getX() with getXValue() and getY() with 
 *               getYValue() (DG);
 * 18-Nov-2004 : Updated for changes in RangeInfo interface (DG);
 * 11-Jan-2005 : Removed deprecated code in preparation for the 1.0.0 
 *               release (DG);
 * 
 */

package org.jfree.data.jdbc;

import java.sql.Connection;
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 java.util.ArrayList;
import java.util.Date;

import org.jfree.data.Range;
import org.jfree.data.RangeInfo;
import org.jfree.data.general.Dataset;
import org.jfree.data.xy.AbstractXYDataset;
import org.jfree.data.xy.TableXYDataset;
import org.jfree.data.xy.XYDataset;
import org.jfree.util.Log;

/**
 * This class provides an {@link XYDataset} 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 x-axis and remaining columns y-axis values.
 * executeQuery can be called a number of times.
 *
 * The database connection is read-only and no write back facility exists.
 */
public class JDBCXYDataset extends AbstractXYDataset 
                           implements XYDataset, 
                                      TableXYDataset, 
                                      RangeInfo {

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

    /** Column names. */
    private String[] columnNames = {};

    /** Rows. */
    private ArrayList rows;

    /** The maximum y value of the returned result set */
    private double maxValue = 0.0;

    /** The minimum y value of the returned result set */
    private double minValue = 0.0;

    /** Is this dataset a timeseries ? */
    private boolean isTimeSeries = false;

    /**
     * Creates a new JDBCXYDataset (initially empty) with no database 
     * connection.
     */
    private JDBCXYDataset() {
        this.rows = new ArrayList();
    }

    /**
     * Creates a new dataset (initially empty) and establishes a new database 
     * connection.
     *
     * @param  url  URL of the database connection.
     * @param  driverName  the database driver class name.
     * @param  user  the database user.
     * @param  password  the database user's password.
     * 
     * @throws ClassNotFoundException if the driver cannot be found.
     * @throws SQLException if there is a problem connecting to the database.
     */
    public JDBCXYDataset(String url,
                         String driverName,
                         String user,
                         String password)
        throws SQLException, ClassNotFoundException {
        
        this();
        Class.forName(driverName);
        this.connection = DriverManager.getConnection(url, user, password);
    }

    /**
     * Creates a new dataset (initially empty) using the specified database 
     * connection.
     *
     * @param  con  the database connection.
     * 
     * @throws SQLException if there is a problem connecting to the database.
     */
    public JDBCXYDataset(Connection con) throws SQLException {
        this();
        this.connection = con;
    }

    /**
     * Creates a new dataset using the specified database connection, and 
     * populates it using data obtained with the supplied query.
     *
     * @param con  the connection.
     * @param query  the SQL query.
     * 
     * @throws SQLException if there is a problem executing the query.
     */
    public JDBCXYDataset(Connection con, String query) throws SQLException {
        this(con);
        executeQuery(query);
    }

    /**
     * Returns <code>true</code> if the dataset represents time series data, 
     * and <code>false</code> otherwise.
     * 
     * @return A boolean.
     */
    public boolean isTimeSeries() {
        return this.isTimeSeries;
    }

    /**
     * Sets a flag that indicates whether or not the data represents a time 
     * series.
     * 
     * @param timeSeries  the new value of the flag.
     */
    public void setTimeSeries(boolean timeSeries) {
        this.isTimeSeries = timeSeries;
    }

    /**
     * ExecuteQuery will attempt execute the query passed to it against the
     * existing database connection.  If no connection exists then no action
     * is taken.
     *
     * 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 to be executed.
     * 
     * @throws SQLException if there is a problem executing the query.
     */
    public void executeQuery(String query) throws SQLException {
        executeQuery(this.connection, query);
    }

    /**
     * ExecuteQuery will attempt execute the query passed to it against the
     * provided database connection.  If connection is null then no action is 
     * taken.
     *
     * 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 to be executed.
     * @param  con  the connection the query is to be executed against.
     * 
     * @throws SQLException if there is a problem executing the query.
     */
    public void executeQuery(Connection con, String query) 
        throws SQLException {

        if (con == null) {
            throw new SQLException(
                "There is no database to execute the query."
            );
        }

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

            int numberOfColumns = metaData.getColumnCount();
            int numberOfValidColumns = 0;
            int [] columnTypes = new int[numberOfColumns];
            for (int column = 0; column < numberOfColumns; column++) {
                try {
                    int type = metaData.getColumnType(column + 1);
                    switch (type) {

                        case Types.NUMERIC:
                        case Types.REAL:
                        case Types.INTEGER:
                        case Types.DOUBLE:
                        case Types.FLOAT:
                        case Types.DECIMAL:
                        case Types.BIT:
                        case Types.DATE:
                        case Types.TIME:
                        case Types.TIMESTAMP:
                        case Types.BIGINT:
                        case Types.SMALLINT:
                            ++numberOfValidColumns;
                            columnTypes[column] = type;
                            break;
                        default:
                            Log.warn(
                                "Unable to load column "
                                + column + " (" + type + ","
                                + metaData.getColumnClassName(column + 1) 
                                + ")"
                            );
                            columnTypes[column] = Types.NULL;
                            break;
                    }
                }
                catch (SQLException e) {
                    columnTypes[column] = Types.NULL;
                    throw e;
                }
            }


            if (numberOfValidColumns <= 1) {
                throw new SQLException(
                    "Not enough valid columns where generated by query."
                );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品激情偷乱一区二区∴| 色综合咪咪久久| 久久国产精品露脸对白| 国产成人亚洲综合a∨婷婷| www.日韩大片| 欧美日韩日本视频| 国产精品美女久久久久久久| 日本不卡123| 色婷婷香蕉在线一区二区| 欧美电影免费观看高清完整版| 2019国产精品| 亚洲高清免费一级二级三级| 国产成人鲁色资源国产91色综 | 亚洲欧洲日韩av| 青青草91视频| 欧美在线观看18| 国产精品久久久久久久久久久免费看| 视频精品一区二区| 色婷婷亚洲综合| 亚洲国产成人午夜在线一区| 黄色小说综合网站| 欧美一级二级在线观看| 亚洲影视在线播放| 99久久国产综合精品女不卡| 国产日韩欧美制服另类| 久久精品国产成人一区二区三区 | 亚洲电影第三页| 波多野结衣在线一区| 制服丝袜亚洲网站| 亚洲电影第三页| 欧美日韩综合色| 亚洲va国产天堂va久久en| 欧洲精品在线观看| 国产欧美日韩在线| 国产另类ts人妖一区二区| 精品日韩在线观看| 狠狠色综合日日| 欧美成人高清电影在线| 久久不见久久见免费视频7| 91精品国产手机| 99精品久久只有精品| 狂野欧美性猛交blacked| 一个色在线综合| 亚洲激情图片qvod| 午夜影视日本亚洲欧洲精品| 国产亚洲精品中文字幕| 一区二区激情小说| 欧美人xxxx| 国产精品每日更新在线播放网址| 久久九九国产精品| 久久色.com| 日本一区二区三区电影| 国产精品伦理一区二区| 伊人性伊人情综合网| 国产激情偷乱视频一区二区三区| 久久免费精品国产久精品久久久久| 91麻豆高清视频| 亚洲九九爱视频| 91精选在线观看| 国产一区二区三区免费| 中文字幕亚洲精品在线观看| 一本到不卡免费一区二区| 亚洲综合色丁香婷婷六月图片| 欧美精品精品一区| 国产美女久久久久| 亚洲人成小说网站色在线| 欧美日韩国产另类一区| 久久99精品国产麻豆不卡| 国产精品久久久久久久久快鸭| 欧美性感一类影片在线播放| 理论电影国产精品| 亚洲三级免费观看| 91精品国产一区二区三区| 成人精品国产一区二区4080| 午夜欧美视频在线观看 | 久久久久99精品国产片| 色综合激情五月| 精品在线一区二区| 亚洲免费毛片网站| 26uuu另类欧美| 欧洲精品中文字幕| 高清国产一区二区| 日韩精品乱码免费| 亚洲天堂免费在线观看视频| 欧美成人综合网站| 色狠狠一区二区| 国产精品一区不卡| 亚洲电影第三页| 亚洲免费伊人电影| 国产欧美精品一区aⅴ影院| 欧美日韩国产美| 91影院在线观看| 国产精品18久久久| 奇米精品一区二区三区在线观看一| 国产精品久久精品日日| 精品国产露脸精彩对白| 久久久青草青青国产亚洲免观| 欧美日韩成人综合在线一区二区| 成人性生交大合| 捆绑紧缚一区二区三区视频| 亚洲大尺度视频在线观看| 久久久精品一品道一区| 日韩欧美激情一区| 9191成人精品久久| 成人国产亚洲欧美成人综合网| 亚洲天堂成人网| 色诱视频网站一区| 日本成人在线网站| 国产精品久久久久久妇女6080| 成人午夜短视频| 免播放器亚洲一区| 国产精品网站在线| 欧美日韩在线播放| 丁香天五香天堂综合| 一区二区三区不卡视频| 日韩一级视频免费观看在线| 成人国产免费视频| 麻豆精品久久久| 中文字幕在线不卡一区| 欧美一级黄色录像| 色综合咪咪久久| 国产精品99久久久久久似苏梦涵| 激情小说欧美图片| 国产aⅴ精品一区二区三区色成熟| 亚洲天堂精品在线观看| 色香蕉久久蜜桃| 无码av免费一区二区三区试看| 精品系列免费在线观看| 一区二区国产盗摄色噜噜| 久久久久久久av麻豆果冻| 欧美剧情片在线观看| 亚洲自拍偷拍av| 欧美精品xxxxbbbb| 91尤物视频在线观看| 激情综合一区二区三区| 国产精品一区二区免费不卡| 国内精品视频一区二区三区八戒| 精品一区二区三区免费视频| 国产精品亚洲一区二区三区妖精| 日韩视频在线一区二区| 日韩精品一区二区三区在线播放| xfplay精品久久| 国产精品视频观看| 亚洲国产视频一区二区| 久久精品国产一区二区三| 国产美女精品一区二区三区| a4yy欧美一区二区三区| 视频一区二区国产| 免费精品视频在线| 高清国产午夜精品久久久久久| 成人精品小蝌蚪| 欧美日韩精品一区二区在线播放| 欧美日韩一二三区| 日韩一区二区三区高清免费看看| 亚洲视频综合在线| 狠狠色狠狠色综合系列| 亚洲激情一二三区| 亚洲天堂免费在线观看视频| 午夜成人在线视频| 成人午夜免费视频| 91精品国产品国语在线不卡| 中文字幕精品在线不卡| 亚洲午夜精品17c| 国产一区二区三区在线观看精品| 91丨九色porny丨蝌蚪| 欧美一级一区二区| 樱桃国产成人精品视频| 国产一区二区三区久久悠悠色av| 91久久精品一区二区三| 精品国产电影一区二区| 亚洲午夜久久久久| 不卡高清视频专区| 日韩免费观看高清完整版在线观看| 欧美激情在线一区二区| 日韩精品每日更新| 日本精品视频一区二区| 国产人成一区二区三区影院| 丝袜a∨在线一区二区三区不卡| 成人自拍视频在线观看| 91精品国产综合久久小美女| 亚洲视频 欧洲视频| 国产成人av在线影院| 日韩一区二区三区视频在线观看| 亚洲精品你懂的| 懂色av一区二区三区蜜臀| 欧美tickle裸体挠脚心vk| 亚洲成人一二三| 色综合av在线| 一区二区三区在线观看视频 | 欧美日韩国产高清一区| 国产精品久久久久三级| 国产麻豆视频精品| 精品免费日韩av| 午夜视黄欧洲亚洲| 欧美裸体一区二区三区| 亚洲制服欧美中文字幕中文字幕| 94色蜜桃网一区二区三区| 中文字幕欧美激情一区| 国内成人自拍视频| 久久综合色之久久综合|