This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

resultset into 2d array

 
Pratheek Patel
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Im looking for the fastest, most efficient way to parse a resultSet into a 2D array. Due to the structure of my program a 2D array is the preferable data structure, i dont want to use a map or a list.

Could anyone please point me to a simple way to parse a resultSet into a 2D array ?

Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such thing as a 2D array, only an array of arrays.

Your result set consists of n results, but you would have to count them first probably with the next() method. Then you would have to go back, and your results in each row would be different type, so unsuitable for an array of arrays. You could more easily create an array of FooResult objects. I am surprised you think a Foo[][] is a suitable data structure for a ResultSet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic