× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



From: Simon Coulter

I'm a little confused (not that that's unusual).  What do you mean
"iterate
through each column"?  The ResultSet in JDBC has a next() method which
positions you to the next row, at which point you do getXxx (e.g.,
getString, getFloat) passing either an ordinal column number or a
String
containing a column name to get the appropriate field from the current
row.
I don't have to iterate through the columns.

You do. Issuing a GetXxx for each column in a row is effectively the
same as iterating over those columns, determining the data type, and
extracting it accordingly.

No, it's not "effectively the same".  It's very different.  From Wikipedia:
"An iterator may be thought of as a type of pointer which has two primary
operations: referencing one particular element in the collection object
(called element access), and modifying itself so it points to the next
element (called element traversal)."

Note the word "next".  Iterating in the computer sense is to process a list
of objects sequentially, one at a time; there's not even an implicit
capability of going backward.  In fact, the next() method in the ResultSet
is a good example of iterating: I can't get to the third record without at
least positioning to the first and second.  You can think of iterating as
sequential access.

The getXxx() methods, on the other hand, are more analogous to random
access; I can get fields in any order I wish, processing whichever fields I
wish and completely ignoring others.  I can get the third field, then the
seventh, then the second. 

Thus the term "iterate" when talking about accessing columns seems somewhat
unclear to me.

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.