java - Turning a ResultSet into 2DArray/HashMap/Lists of Lists -
I think I have become a code-blind.
I am currently doing a small project, a friend and we are using JDBC to choose from our database.
What I need is that after running the selection statement, I get back some sort of '2D' list of all the data.
I think I want something like this - Pseudo code A table - What is the most appropriate data type to use to replicate 'array list, array, or hashmaps'? What is the best way to create You can use the keypad to add important value, Where as the key you add your results metadata and values as values. In addition, I want to say that resultsetUtils array [columnname] [all data inside selected column]
// Calculate all the rows in a column / calculate the column // Add the column name to the 'array' (int i = 1; i & Lt; = columnCount; I ++) columns.add (resultSetMeta.getColumnName (i)); // Adds the result of the first column to 'array'. // How can I add results to numbers? For (int i = 1; i & lt; = rowCount; i ++) {while (resultSet.next ()) rows.add (resultSet.getString (i)); } Columns and ROs Input (columns, rows);
ResultSet in a 2D datatype?
ResultSet , how can I go to the next column?
hashMap & lt; string, object & gt; p = new hashmop & lt; String, Object & gt; (); P.put ("ResultSetkey1", "ResultSetvalue1"); P.put ("ResultSetkey2", "ResultSetvalue2");
Comments
Post a Comment