3 messages in com.mysql.lists.javaRe: order of rows
FromSent OnAttachments
Jeff Mathis12 Feb 2003 12:31 
Jeff Mathis12 Feb 2003 12:35 
Christopher Taylor12 Feb 2003 16:42 
Subject:Re: order of rows
From:Christopher Taylor (csta@nanshu.com)
Date:02/12/2003 04:42:45 PM
List:com.mysql.lists.java

Jeff,

Yeah, we do something similar in our applications. The easiest way to sort those items is to make a TreeMap with a Comparator that sorts your objects with the proper key, and then call putAll() on the TreeMap passing your existing HashMap as a parameter.

Or you could just blow off the HashMap altogether and just use the TreeMap from the beginning... depending on the number of objects we're talking about, the performance wouldn't be much different (AFAIK).

-Chris

Jeff Mathis wrote:

never mind. as usual, I've not looked carefully at my own code. I'm creating objects from the rows and putting those objects into a HashSet, and then calling iterator(), which we all know is not guaranteed to be in the order you think.

jeff

hello all,

I'm noticing that the order of rows returnd from a mysql query submitted at the mysql prompt is not the same as the order returned from submitting the same query through the api. Is there a reason for this?

In particular, I can put an order by clause on the sql query that the mysql pay attention to, but the api seems to ignore.

To request this thread, e-mail <java@lists.mysql.com> To unsubscribe, e-mail

<java-unsubscribe-jmathis=pred@lists.mysql.com>

To request this thread, e-mail <java@lists.mysql.com> To unsubscribe, e-mail <java-unsubscribe-cstaylor=nans@lists.mysql.com>