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

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

?? jdbcpiedataset.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.]
 *
 * -------------------
 * JDBCPieDataset.java
 * -------------------
 * (C) Copyright 2002-2004, by Bryan Scott and Contributors.
 *
 * Original Author:  Bryan Scott; Andy
 * Contributor(s):   David Gilbert (for Object Refinery Limited);
 *                   Thomas Morgner;
 * 
 * $ Id: $
 *
 * Changes
 * -------
 * 26-Apr-2002 : Creation based on JdbcXYDataSet, but extending 
 *               DefaultPieDataset (BS);
 * 24-Jun-2002 : Removed unnecessary import and local variable (DG);
 * 13-Aug-2002 : Updated Javadoc comments and imports, removed default 
 *               constructor (DG);
 * 18-Sep-2002 : Updated to support BIGINT (BS);
 * 21-Jan-2003 : Renamed JdbcPieDataset --> JDBCPieDataset (DG);
 * 03-Feb-2003 : Added Types.DECIMAL (see bug report 677814) (DG);
 * 05-Jun-2003 : Updated to support TIME, optimised executeQuery method (BS);
 * 30-Jul-2003 : Added empty contructor and executeQuery(connection,string) 
 *               method (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.DriverManager;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;

import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;

/**
 * A {@link PieDataset} that reads data from a database via JDBC.
 * <P>
 * A query should be supplied that returns data in two columns, the first 
 * containing VARCHAR data, and the second containing numerical data.  The 
 * data is cached in-memory and can be refreshed at any time.
 *
 * @author Bryan Scott.
 */
public class JDBCPieDataset extends DefaultPieDataset {

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

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

    /**
     * Creates a new JDBCPieDataset using a pre-existing database connection.
     * <P>
     * The dataset is initially empty, since no query has been supplied yet.
     *
     * @param con  the database connection.
     */
    public JDBCPieDataset(Connection con) {
        if (con == null) {
            throw new NullPointerException("A connection must be supplied.");
        }
        this.connection = con;
    }


    /**
     * Creates a new JDBCPieDataset using a pre-existing database connection.
     * <P>
     * The dataset is initialised with the supplied query.
     *
     * @param con  the database connection.
     * @param query  the database connection.
     * 
     * @throws SQLException if there is a problem executing the query.
     */
    public JDBCPieDataset(Connection con, String query) throws SQLException {
        this(con);
        executeQuery(query);
    }

    /**
     *  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
     *  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
     * @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 {

        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(
                    "Invalid sql generated.  PieDataSet requires 2 columns only"
                );
            }

            int columnType = metaData.getColumnType(2);
            double value = Double.NaN;
            while (resultSet.next()) {
                Comparable key = resultSet.getString(1);
                switch (columnType) {
                    case Types.NUMERIC:
                    case Types.REAL:
                    case Types.INTEGER:
                    case Types.DOUBLE:
                    case Types.FLOAT:
                    case Types.DECIMAL:
                    case Types.BIGINT:
                        value = resultSet.getDouble(2);
                        setValue(key, value);
                        break;

                    case Types.DATE:
                    case Types.TIME:
                    case Types.TIMESTAMP:
                        Timestamp date = resultSet.getTimestamp(2);
                        value = date.getTime();
                        setValue(key, value);
                        break;

                    default:
                        System.err.println(
                            "JDBCPieDataset - unknown data type"
                        );
                        break;
                }
            }

            fireDatasetChanged();

        }
        finally {
            if (resultSet != null) {
                try {
                    resultSet.close();
                }
                catch (Exception e) {
                    System.err.println("JDBCPieDataset: swallowing exception.");
                }
            }
            if (statement != null) {
                try {
                    statement.close();
                }
                catch (Exception e) {
                    System.err.println("JDBCPieDataset: swallowing exception.");
                }
            }
        }
    }


    /**
     * Close the database connection
     */
    public void close() {
        try {
            this.connection.close();
        }
        catch (Exception e) {
            System.err.println("JdbcXYDataset: swallowing exception.");
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久99久久免费精品蜜臀| 狠狠色2019综合网| 欧美日韩精品系列| 日韩国产欧美在线播放| 91精品国产福利| 久久机这里只有精品| 久久久久久久久久久99999| 国产成人高清视频| 国产精品久久久久aaaa| 色综合久久66| 日韩和欧美一区二区三区| 日韩视频一区二区在线观看| 国产又黄又大久久| 亚洲欧美色图小说| 欧美日韩国产一二三| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美tk—视频vk| 成人在线综合网站| 亚洲国产精品一区二区久久恐怖片| 欧美另类一区二区三区| 国产精品88888| 一区二区三区在线免费| 制服丝袜中文字幕亚洲| 国产成人欧美日韩在线电影| 亚洲伦在线观看| 日韩欧美区一区二| 99精品国产91久久久久久| 日本成人在线网站| ㊣最新国产の精品bt伙计久久| 欧美日韩你懂得| 国产成人精品免费| 污片在线观看一区二区| 中文一区二区完整视频在线观看| 欧美视频精品在线| 国产剧情一区二区| 午夜精品久久久久久久久| 国产日韩欧美高清| 欧美一区二区三区免费视频| 不卡视频一二三| 久久99久久精品| 一级女性全黄久久生活片免费| 精品sm在线观看| 欧美日韩一区小说| 99久久久久久| 国产不卡高清在线观看视频| 午夜久久久久久电影| 综合久久久久久| 久久女同性恋中文字幕| 91精品国产综合久久蜜臀| 91蜜桃视频在线| 国产成人av电影在线观看| 日本午夜一本久久久综合| 亚洲日韩欧美一区二区在线| 久久久午夜电影| 日韩精品一区二区三区中文不卡| 在线观看免费视频综合| av在线不卡免费看| 国产精品18久久久久久久久久久久| 亚洲va在线va天堂| 亚洲最大的成人av| 亚洲日本电影在线| 亚洲欧美一区二区视频| 久久精品人人做人人综合 | 在线看不卡av| 91在线精品一区二区| 成人av网在线| 成人午夜私人影院| 国产91丝袜在线18| 岛国av在线一区| 不卡在线视频中文字幕| 成人一区二区三区| 国产传媒欧美日韩成人| 国产一区二区三区蝌蚪| 国产一区欧美日韩| 国内外成人在线| 激情五月婷婷综合| 国产剧情av麻豆香蕉精品| 国产精品综合一区二区三区| 国精品**一区二区三区在线蜜桃| 久久精品久久综合| 国产伦精品一区二区三区在线观看 | 日韩精品一区二区三区在线 | 美女视频黄久久| 老司机免费视频一区二区| 另类综合日韩欧美亚洲| 国产精品一线二线三线精华| 国产在线麻豆精品观看| 国产精品18久久久久| 国产激情一区二区三区四区| 国产aⅴ综合色| 91原创在线视频| 在线视频亚洲一区| 欧美福利一区二区| 精品久久久久久久久久久久久久久久久| 日韩欧美高清一区| 久久久99精品免费观看| 中文字幕在线一区二区三区| 一区二区三区在线视频观看| 亚洲成人自拍网| 国产综合久久久久影院| 风间由美一区二区三区在线观看| 99久久精品情趣| 欧美在线观看18| 91精品国产综合久久小美女| 久久久久久久综合狠狠综合| 国产精品久久久久毛片软件| 亚洲免费av观看| 日韩电影一二三区| 国产福利一区二区三区在线视频| 99这里只有精品| 日韩一区二区视频在线观看| 国产欧美一区视频| 香蕉久久夜色精品国产使用方法 | 国产在线精品视频| 99麻豆久久久国产精品免费| 欧美三级日韩在线| 久久久国产精品午夜一区ai换脸| 亚洲激情网站免费观看| 激情综合亚洲精品| 欧美性xxxxxx少妇| 国产精品视频在线看| 午夜国产不卡在线观看视频| 国产aⅴ精品一区二区三区色成熟| 在线观看91视频| 亚洲国产精品精华液ab| 亚洲h在线观看| 97久久精品人人做人人爽| 精品久久99ma| 亚洲亚洲精品在线观看| 国产河南妇女毛片精品久久久| 欧美视频中文一区二区三区在线观看 | www久久精品| 亚洲亚洲人成综合网络| 不卡视频免费播放| www日韩大片| 蜜乳av一区二区| 欧美少妇一区二区| 亚洲天堂网中文字| 国产电影一区二区三区| 日韩一级片在线播放| 亚洲一区二区三区美女| 成人夜色视频网站在线观看| 日韩免费观看2025年上映的电影| 亚洲影视资源网| 99re成人在线| 中文字幕一区二区三区在线观看| 精品一区二区三区蜜桃| 91精品国产一区二区| 亚洲免费在线观看视频| 成人一区二区三区中文字幕| 一区二区三区美女| 91香蕉视频污在线| 国产精品久久久久久久久免费樱桃 | 一区二区三区四区蜜桃| 成人免费毛片片v| 久久久久久久久久久久久久久99| 欧美最猛黑人xxxxx猛交| 亚洲视频一区在线观看| 成人的网站免费观看| 国产日韩欧美麻豆| 风间由美性色一区二区三区| 国产亚洲视频系列| 国产高清不卡二三区| 久久久五月婷婷| 国产成人免费视频精品含羞草妖精| 日韩视频免费观看高清完整版| 午夜精品久久久久久久| 欧美日韩在线三级| 无码av中文一区二区三区桃花岛| 欧美日本一区二区| 午夜激情综合网| 欧美成人a∨高清免费观看| 日韩经典中文字幕一区| 日韩一卡二卡三卡四卡| 麻豆91精品91久久久的内涵| 日韩欧美电影在线| 国产一区二区三区精品欧美日韩一区二区三区| 欧美电视剧在线看免费| 激情综合亚洲精品| 日本一区二区视频在线观看| 99视频热这里只有精品免费| 中文字幕第一区| 欧洲生活片亚洲生活在线观看| 亚洲午夜视频在线| 欧美xfplay| 国产91丝袜在线观看| 亚洲色图在线视频| 911精品国产一区二区在线| 麻豆久久久久久| 国产精品久久久久影视| 色88888久久久久久影院野外| 亚洲一区二区三区爽爽爽爽爽| 欧美精品乱码久久久久久| 久久国产麻豆精品| 欧美高清在线一区二区| 欧美在线你懂的| 激情综合色播五月| 亚洲视频每日更新| 欧美一区日本一区韩国一区| 国产精品亚洲一区二区三区妖精 |