24
24
import java .sql .PreparedStatement ;
25
25
import java .sql .ResultSet ;
26
26
import java .sql .SQLException ;
27
+
28
+ import io .hops .metadata .hdfs .dal .SQLResultSetHandler ;
27
29
import org .apache .commons .logging .Log ;
28
30
import org .apache .commons .logging .LogFactory ;
29
31
@@ -125,7 +127,7 @@ public static long maxLong(String tableName, String column)
125
127
126
128
public static int executeIntAggrQuery (final String query )
127
129
throws StorageException {
128
- return execute (query , new ResultSetHandler <Integer >() {
130
+ return execute (query , new SQLResultSetHandler <Integer >() {
129
131
@ Override
130
132
public Integer handle (ResultSet result ) throws SQLException , StorageException {
131
133
if (!result .next ()) {
@@ -139,7 +141,7 @@ public Integer handle(ResultSet result) throws SQLException, StorageException {
139
141
140
142
public static long executeLongAggrQuery (final String query )
141
143
throws StorageException {
142
- return execute (query , new ResultSetHandler <Long >() {
144
+ return execute (query , new SQLResultSetHandler <Long >() {
143
145
@ Override
144
146
public Long handle (ResultSet result ) throws SQLException , StorageException {
145
147
if (!result .next ()) {
@@ -153,7 +155,7 @@ public Long handle(ResultSet result) throws SQLException, StorageException {
153
155
154
156
private static boolean executeBooleanQuery (final String query )
155
157
throws StorageException {
156
- return execute (query , new ResultSetHandler <Boolean >() {
158
+ return execute (query , new SQLResultSetHandler <Boolean >() {
157
159
@ Override
158
160
public Boolean handle (ResultSet result ) throws SQLException , StorageException {
159
161
if (!result .next ()) {
@@ -185,11 +187,7 @@ public static int execute(String query) throws StorageException {
185
187
}
186
188
}
187
189
188
- public interface ResultSetHandler <R > {
189
- R handle (ResultSet result ) throws SQLException , StorageException ;
190
- }
191
-
192
- public static <R > R execute (String query , ResultSetHandler <R > handler )
190
+ public static <R > R execute (String query , SQLResultSetHandler <R > handler )
193
191
throws StorageException {
194
192
try {
195
193
PreparedStatement s = null ;
0 commit comments