For the most part I agree with your argument for using an array[] except for one 
thing...

I would need the array[] declared *after* the resultset is returned but *before* the 
resultset gets loaded into tha hashtable (because as it loads into the hashtable I 
need to place the keys into the array[].)  This means I must declare an array[] with a 
size based on the resultset size right after retrieving the resultset.  Where do you 
get that size?  At that point in the program you have no vectors or hashtables built 
where you can use a size() method against... you can't rset.next() through the data to 
count it because if you do then you can't scroll the cursor back and then you'd have 
to do another query... there is no resultset.size() method that I know of.... and if I 
do a second query for the sole purpose of returning just the count(*) of the rows I 
just gave up any speed enhancements the array[] would have given me.

Don't get me wrong, these are not so much arguments against using an array[] as they 
are valid questions that I would actually like to know the answers to as I have 
stumbled up against this situation before.

Darren

>>> Thomas Moore <[EMAIL PROTECTED]> 03/23 12:16 PM >>Robert Crawford observed:
> An array is not a data structure. An array assumes too much...
[much array-bashing snipped]
> Finally, "overhead" is a poor reason to choose an array.
> Considering he's using a connection to a database, I'd guess the
> latency between the servlet and the database to be very much
> larger than any extra work done in accessing a Vector.

        Ummmm....  Valid points if the person uses something like:
private static final int MAX_SIZE = 50;

        ...but I was thinking of sizing the array based on the result set.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to