3838
3939public class SQLResultSet implements ResultSet {
4040
41- private final CursorIterator <List <Object >> iterator ;
42- private final SQLResultSetMetaData metaData ;
41+ private CursorIterator <List <Object >> iterator ;
42+ private SQLResultSetMetaData metaData ;
4343
4444 private Map <String , Integer > columnByNameLookups ;
4545
46- private final Statement statement ;
46+ private final TarantoolStatement statement ;
4747 private final int maxRows ;
4848
4949 private AtomicBoolean isClosed = new AtomicBoolean (false );
@@ -52,7 +52,7 @@ public class SQLResultSet implements ResultSet {
5252 private final int concurrencyLevel ;
5353 private final int holdability ;
5454
55- public SQLResultSet (SQLResultHolder holder , SQLStatement ownerStatement ) throws SQLException {
55+ public SQLResultSet (SQLResultHolder holder , TarantoolStatement ownerStatement ) throws SQLException {
5656 metaData = new SQLResultSetMetaData (holder .getSqlMetadata ());
5757 statement = ownerStatement ;
5858 scrollType = statement .getResultSetType ();
@@ -89,7 +89,13 @@ public List<Object> getCurrentRow() throws SQLException {
8989 @ Override
9090 public void close () throws SQLException {
9191 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+ }
9399 }
94100 }
95101
@@ -370,11 +376,13 @@ public String getCursorName() throws SQLException {
370376
371377 @ Override
372378 public ResultSetMetaData getMetaData () throws SQLException {
379+ checkNotClosed ();
373380 return metaData ;
374381 }
375382
376383 @ Override
377384 public int findColumn (String columnLabel ) throws SQLException {
385+ checkNotClosed ();
378386 return findColumnIndex (columnLabel );
379387 }
380388
@@ -1099,7 +1107,7 @@ public <T> T unwrap(Class<T> type) throws SQLException {
10991107 if (isWrapperFor (type )) {
11001108 return type .cast (this );
11011109 }
1102- throw new SQLNonTransientException ("ResultSet does not wrap " + type .getName ());
1110+ throw new SQLNonTransientException ("SQLResultSet does not wrap " + type .getName ());
11031111 }
11041112
11051113 @ Override
0 commit comments