From a4cd2d533b2f47e73eea41d603aec2dca97ce9f7 Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 13 Sep 2005 02:16:03 +0000 Subject: [PATCH] Added a close() method so that we can explicitely close free the resources used internally to the Cursor without having to read each object. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1715 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/jdbc/jora/Cursor.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/samskivert/src/java/com/samskivert/jdbc/jora/Cursor.java b/projects/samskivert/src/java/com/samskivert/jdbc/jora/Cursor.java index a3385bbe..dfe5aace 100644 --- a/projects/samskivert/src/java/com/samskivert/jdbc/jora/Cursor.java +++ b/projects/samskivert/src/java/com/samskivert/jdbc/jora/Cursor.java @@ -141,6 +141,21 @@ public class Cursor { // catch (SQLException ex) { session.handleSQLException(ex); } } + /** + * Close the Cursor, even if we haven't read all the possible + * objects. + */ + public void close () + throws SQLException + { + if (stmt != null) { + stmt.close(); // also automatically closes result + result = null; + stmt = null; + } + nTables = 0; + } + /** Extracts no more than maxElements records from database and * store them into array. It is possible to extract rest records * by successive next() or toArray() calls. Selected objects should