@@ -0,0 +1,2128 @@
+package utility;%0A%0Aimport java.sql.ResultSet;%0Aimport java.sql.ResultSetMetaData;%0Aimport java.sql.SQLException;%0A%0A/**%0A * ResultSet utility methods%0A */%0Apublic class ResultSetUtil %7B%0A%0A    public static void print(ResultSet resultSet) %7B%0A        /* Method based on http://stackoverflow.com/a/28165814/3626537 */%0A        try %7B%0A            ResultSetMetaData resultSetMetaData = resultSet.getMetaData();%0A            int columnsNumber = resultSetMetaData.getColumnCount();%0A            while (resultSet.next()) %7B%0A                for (int i = 1; i %3C= columnsNumber; i++) %7B%0A                    if (i %3E 1) System.out.print(%22,  %22);%0A                    String columnValue = resultSet.getString(i);%0A                    System.out.print(resultSetMetaData.getColumnName(i) +%22: %22 + columnValue);%0A                %7D%0A                System.out.println(%22%22);%0A            %7D%0A        %7D catch (SQLException exc) %7B%0A            exc.printStackTrace();%0A        %7D%0A    %7D%0A%0A    public static String%5B%5D%5B%5D toString2dArray(ResultSet resultSet) %7B%0A        /* Method based on http://stackoverflow.com/q/20021139/3626537 */%0A        String%5B%5D%5B%5D resultArray;%0A        int rowSize = 0;%0A        int columnSize = 0;%0A%0A        try %7B%0A            resultSet.last();%0A            rowSize = resultSet.getRow();%0A            resultSet.beforeFirst();%0A            ResultSetMetaData resultSetMetaData = resultSet.getMetaData();%0A            columnSize = resultSetMetaData.getColumnCount();%0A        %7D catch (SQLException exc) %7B%0A            exc.printStackTrace();%0A        %7D%0A%0A        resultArray = new String%5BrowSize%5D%5BcolumnSize%5D;%0A        /*%0A         * SQL rows & columns are 1-indexed while Java arrays are 0-indexed,%0A         * hence the need for the +1 and -1 manipulations of indexes in this loop.%0A         */%0A        int row = 1;%0A        try %7B%0A            while (resultSet.next()) %7B%0A                for(int col = 1 ; col %3C columnSize +1; col++) %7B%0A                    resultArray%5Brow-1%5D%5Bcol-1%5D = resultSet.getString(col);%0A                %7D%0A                row++;%0A            %7D%0A        %7D catch (SQLException exc) %7B%0A            exc.printStackTrace();%0A        %7D%0A        return resultArray;%0A    %7D%0A%7D%0A

Consolidate methods into ResultSetUtil