This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I'm looking through a textbook (Java How to program by Dietel abd Dietel) which provides some code to connect to database and then to display the database on the screen. However, I am trying to understand the code and can't understand the following methods. From what i can see currentRow is a vector within a set of other vectors; rows. Am I right? Basically I just want to know how the vectors in this code extract work. Thanks.
There are 3 uses of Vector in this code. 1. "columnHeads" Vector - This is a simple Vector that contains the column names returned in the query, i.e. each element in the Vector is a String that represents each column name. If the query returns 100 rows with 5 columns, then "columnHeads" will contain 5 elements: one for each column name. 2. "rows" Vector - This Vector is used to represent a single row of the query. Each element in this Vector is another Vector returned by the getNextRow() method, i.e. this is a Vector of Vectors. If the query returns 100 rows with 5 columns, then "rows" will contain 100 elements: one for each "row" returned by the query. 3. "currentRow" Vector - This Vector is returned by the getNextRow() method. Each element in this Vector is the field value for a specific row and column of the query. As each row in the query is processed, the specific field values for that single row are added as elements of this Vector. If the query returns 100 rows with 5 columns, then "currentRow" will contain 5 elements: one for each field value. Each "currentRow" Vector gets placed into the "rows" Vector above. Hopefully that helps a little bit.
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"