JDBCCategoryDataset & Queries

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
chris

JDBCCategoryDataset & Queries

Post by chris » Mon Sep 22, 2003 1:57 pm

hi all,

It's seems to me that a JDBCCategoryDataset IS NOT CLEARED between 2 queries... I mean that a JDBCCategoryDataset object, already used in a previous "Select" query, keeps in memory results from this previous query.

Code: Select all

// Database Connection
...
// 1st Select Query
myJDBCCD.executeQuery("select toto, tutu from ....");
// 2nd call
myJDBCCD.executeQuery("select titi, tata from ....");
// myJDBCCD object contain titi and tata values (that's ok!) but also toto and tutu values (no good!!)
It's normal?
Thanks.

arnaud
Posts: 86
Joined: Wed Mar 19, 2003 2:59 pm
Location: Paris, France
Contact:

Post by arnaud » Mon Sep 22, 2003 8:00 pm

Hello,

The inside code can be found in org.jfree.data.JDBCCategoryDataset :

Code: Select all

[...]
        try {
            statement = con.createStatement();
            resultSet = statement.executeQuery(query);
            metaData = resultSet.getMetaData();
[...]
So you're right.

But that feature is also very interesting as it permits you to complete your dataset with different queries to different datasources.

I suggest you to simply create a new dataset.

I'll make a proposition to change the javadoc information to be more explicit.

Regards,
Arnaud

Bryan.Scott
Posts: 26
Joined: Fri May 09, 2003 4:55 am
Location: Tasmania, Australia
Contact:

This was not what was intended

Post by Bryan.Scott » Wed Sep 24, 2003 12:36 pm

Hi

This is not the intended outcome.

I am suggesting changing to resolve and clear data prior to any new queries. This is what happens in JDBCXYDataset and it would make sense to be consistant across the JDBC Dataset series.

Is anyone using the feature as arnaud suggests?
Bryan

wwlhp

Post by wwlhp » Thu Sep 25, 2003 3:02 am

how about fetching three columns in the first query, but two columns in the second query?

Locked