1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package javax.servlet.jsp.jstl.sql;
18
19 import java.sql.ResultSet;
20 import java.sql.SQLException;
21
22 /***
23 * <p>This class represents the conversion of a ResultSet to
24 * a Result object.</p>
25 *
26 *
27 * @author Justyna Horwat
28 *
29 */
30 public class ResultSupport {
31
32
33 /***
34 * Returns an array of Row objects.
35 *
36 * @param ResultSet the ResultSet object
37 *
38 * @return the <code>Result</code> object of the result
39 */
40 public static Result toResult(ResultSet rs) {
41 try {
42 return new ResultImpl(rs, -1, -1);
43 } catch (SQLException ex) {
44 return null;
45 }
46 }
47
48 /***
49 * Returns the Result object of the cached ResultSet limited by maxRows
50 *
51 * @param ResultSet the ResultSet object
52 * @param maxRows the maximum number of rows
53 *
54 * @return the <code>Result</code> object of the result limited by maxRows
55 */
56 public static Result toResult(ResultSet rs, int maxRows) {
57 try {
58 return new ResultImpl(rs, -1, maxRows);
59 } catch (SQLException ex) {
60 return null;
61 }
62 }
63
64 }