]> WPIA git - gigi.git/blob - src/org/cacert/gigi/database/GigiResultSet.java
fix: ResultSet.getDate is often wrong as it fetches day-precision times
[gigi.git] / src / org / cacert / gigi / database / GigiResultSet.java
1 package org.cacert.gigi.database;
2
3 import java.io.Closeable;
4 import java.sql.Date;
5 import java.sql.ResultSet;
6 import java.sql.SQLException;
7 import java.sql.Timestamp;
8
9 public class GigiResultSet implements Closeable {
10
11     private ResultSet target;
12
13     public GigiResultSet(ResultSet target) {
14         this.target = target;
15     }
16
17     public String getString(int columnIndex) {
18         try {
19             return target.getString(columnIndex);
20         } catch (SQLException e) {
21             handleSQL(e);
22             throw new Error(e);
23         }
24     }
25
26     public boolean getBoolean(int columnIndex) {
27         try {
28             return target.getBoolean(columnIndex);
29         } catch (SQLException e) {
30             handleSQL(e);
31             throw new Error(e);
32         }
33     }
34
35     public int getInt(int columnIndex) {
36         try {
37             return target.getInt(columnIndex);
38         } catch (SQLException e) {
39             handleSQL(e);
40             throw new Error(e);
41         }
42     }
43
44     public Date getDate(int columnIndex) {
45         try {
46             return target.getDate(columnIndex);
47         } catch (SQLException e) {
48             handleSQL(e);
49             throw new Error(e);
50         }
51     }
52
53     public Timestamp getTimestamp(int columnIndex) {
54         try {
55             return target.getTimestamp(columnIndex);
56         } catch (SQLException e) {
57             handleSQL(e);
58             throw new Error(e);
59         }
60     }
61
62     public String getString(String columnLabel) {
63         try {
64             return target.getString(columnLabel);
65         } catch (SQLException e) {
66             handleSQL(e);
67             throw new Error(e);
68         }
69     }
70
71     public boolean getBoolean(String columnLabel) {
72         try {
73             return target.getBoolean(columnLabel);
74         } catch (SQLException e) {
75             handleSQL(e);
76             throw new Error(e);
77         }
78     }
79
80     public int getInt(String columnLabel) {
81         try {
82             return target.getInt(columnLabel);
83         } catch (SQLException e) {
84             handleSQL(e);
85             throw new Error(e);
86         }
87     }
88
89     public Date getDate(String columnLabel) {
90         try {
91             return target.getDate(columnLabel);
92         } catch (SQLException e) {
93             handleSQL(e);
94             throw new Error(e);
95         }
96     }
97
98     public Timestamp getTimestamp(String columnLabel) {
99         try {
100             return target.getTimestamp(columnLabel);
101         } catch (SQLException e) {
102             handleSQL(e);
103             throw new Error(e);
104         }
105     }
106
107     public boolean next() {
108         try {
109             return target.next();
110         } catch (SQLException e) {
111             handleSQL(e);
112             throw new Error(e);
113         }
114     }
115
116     public int getRow() {
117         try {
118             return target.getRow();
119         } catch (SQLException e) {
120             handleSQL(e);
121             throw new Error(e);
122         }
123     }
124
125     public void beforeFirst() {
126         try {
127             target.beforeFirst();
128         } catch (SQLException e) {
129             handleSQL(e);
130             throw new Error(e);
131         }
132     }
133
134     public void last() {
135         try {
136             target.last();
137         } catch (SQLException e) {
138             handleSQL(e);
139             throw new Error(e);
140         }
141     }
142
143     public void close() {
144         try {
145             target.close();
146         } catch (SQLException e) {
147             handleSQL(e);
148             throw new Error(e);
149         }
150
151     }
152
153     private void handleSQL(SQLException e) {
154         // TODO Auto-generated method stub
155
156     }
157
158 }