38
38
39
39
public class SQLResultSet implements ResultSet {
40
40
41
- private final CursorIterator <List <Object >> iterator ;
42
- private final SQLResultSetMetaData metaData ;
41
+ private CursorIterator <List <Object >> iterator ;
42
+ private SQLResultSetMetaData metaData ;
43
43
44
44
private Map <String , Integer > columnByNameLookups ;
45
45
46
- private final Statement statement ;
46
+ private final TarantoolStatement statement ;
47
47
private final int maxRows ;
48
48
49
49
private AtomicBoolean isClosed = new AtomicBoolean (false );
@@ -52,7 +52,7 @@ public class SQLResultSet implements ResultSet {
52
52
private final int concurrencyLevel ;
53
53
private final int holdability ;
54
54
55
- public SQLResultSet (SQLResultHolder holder , SQLStatement ownerStatement ) throws SQLException {
55
+ public SQLResultSet (SQLResultHolder holder , TarantoolStatement ownerStatement ) throws SQLException {
56
56
metaData = new SQLResultSetMetaData (holder .getSqlMetadata ());
57
57
statement = ownerStatement ;
58
58
scrollType = statement .getResultSetType ();
@@ -89,7 +89,13 @@ public List<Object> getCurrentRow() throws SQLException {
89
89
@ Override
90
90
public void close () throws SQLException {
91
91
if (isClosed .compareAndSet (false , true )) {
92
- iterator .close ();
92
+ try {
93
+ iterator .close ();
94
+ iterator = null ;
95
+ metaData = null ;
96
+ } finally {
97
+ statement .checkCompletion ();
98
+ }
93
99
}
94
100
}
95
101
@@ -370,11 +376,13 @@ public String getCursorName() throws SQLException {
370
376
371
377
@ Override
372
378
public ResultSetMetaData getMetaData () throws SQLException {
379
+ checkNotClosed ();
373
380
return metaData ;
374
381
}
375
382
376
383
@ Override
377
384
public int findColumn (String columnLabel ) throws SQLException {
385
+ checkNotClosed ();
378
386
return findColumnIndex (columnLabel );
379
387
}
380
388
@@ -1099,7 +1107,7 @@ public <T> T unwrap(Class<T> type) throws SQLException {
1099
1107
if (isWrapperFor (type )) {
1100
1108
return type .cast (this );
1101
1109
}
1102
- throw new SQLNonTransientException ("ResultSet does not wrap " + type .getName ());
1110
+ throw new SQLNonTransientException ("SQLResultSet does not wrap " + type .getName ());
1103
1111
}
1104
1112
1105
1113
@ Override
0 commit comments