Mercurial > hg > monetdb-java
diff src/main/java/org/monetdb/jdbc/MonetStatement.java @ 623:1c3cdf0667d7
Do more cleanup in the close() methods such as calling clearWarnings(), clearParameters(), clearBatch() and dereferencing cached objects.
Remove deprecated finalize() method from MonetPreparedStatement. finalize() is deprecated from Java 9 onwards.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 20 Jan 2022 13:00:00 +0100 (2022-01-20) |
parents | 6aa38e8c0f2d |
children | b32999570f4d |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetStatement.java +++ b/src/main/java/org/monetdb/jdbc/MonetStatement.java @@ -252,11 +252,15 @@ public class MonetStatement */ @Override public void close() { + clearBatch(); + clearWarnings(); // close previous ResultSet, if not closed already if (lastResponseList != null) { lastResponseList.close(); lastResponseList = null; } + header = null; + batchLock = null; closed = true; } @@ -904,8 +908,7 @@ public class MonetStatement * general should not be necessary given SQL standards compliance. * In this sense, this driver will ignore any call to this function. * - * @param enable true to enable escape processing; false to disable - * it + * @param enable true to enable escape processing; false to disable it * @throws SQLException if a database access error occurs */ @Override @@ -952,7 +955,7 @@ public class MonetStatement */ @Override public void setFetchSize(final int rows) throws SQLException { - if (rows >= 0 && !(getMaxRows() != 0 && rows > getMaxRows())) { + if (rows >= 0 && !(maxRows != 0 && rows > getMaxRows())) { fetchSize = rows; } else { throw new SQLException("Illegal fetch size value: " + rows, "M1M05"); @@ -1509,7 +1512,7 @@ public class MonetStatement * TODO: try to eliminate the need for this class completely. */ final class MonetVirtualResultSet extends MonetResultSet { - private final String results[][]; + private String results[][]; private boolean closed; MonetVirtualResultSet( @@ -1571,7 +1574,8 @@ final class MonetVirtualResultSet extend */ @Override public void close() { + results = null; closed = true; - // types and columns are MonetResultSets private parts + super.close(); } }