3 messages in com.mysql.lists.javaRe: order of rows| From | Sent On | Attachments |
|---|---|---|
| Jeff Mathis | 12 Feb 2003 12:31 | |
| Jeff Mathis | 12 Feb 2003 12:35 | |
| Christopher Taylor | 12 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
----- Original Message ----- From: "Jeff Mathis" <jmat...@predict.com> To: <ja...@lists.mysql.com> Sent: Thursday, February 13, 2003 5:36 AM Subject: Re: order of rows
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.
jeff
-- Jeff Mathis, Ph.D. 505-995-1434 The Prediction Company jmat...@predict.com 525 Camino de los Marquez, Ste 6 http://www.predict.com Santa Fe, NM 87505
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/doc/ (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <java...@lists.mysql.com> To unsubscribe, e-mail
<java-unsubscribe-jmathis=pred...@lists.mysql.com>
-- Jeff Mathis, Ph.D. 505-995-1434 The Prediction Company jmat...@predict.com 525 Camino de los Marquez, Ste 6 http://www.predict.com Santa Fe, NM 87505
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/doc/ (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <java...@lists.mysql.com> To unsubscribe, e-mail <java-unsubscribe-cstaylor=nans...@lists.mysql.com>




