count optimizaton moved
authorrk <rk>
Wed, 6 Feb 2002 15:57:41 +0000 (15:57 +0000)
committerrk <rk>
Wed, 6 Feb 2002 15:57:41 +0000 (15:57 +0000)
source/mir/storage/Database.java

index 575d374..26e35c2 100755 (executable)
@@ -433,14 +433,16 @@ public class Database implements StorageObject {
           if (rs.next())
             count = rs.getInt(1);
           rs.close();
+          //nothing in the table: return null
+          if(count<=0){
+            freeConnection(con, stmt);
+            return null;
+          }
         } else {
-          theLog.printError("Mh. Konnte nicht zaehlen: " + countSql);
+          theLog.printError("Could not count: " + countSql);
         }
       }
-      //nothing in the table: return null
-      if(count<=0){
-        return null;
-      }
+
       // hier select
       rs = executeSql(stmt, selectSql.toString());
       if (rs != null) {
@@ -1123,7 +1125,7 @@ public class Database implements StorageObject {
   void throwStorageObjectException (String message) throws StorageObjectException {
     _throwStorageObjectException(null, message);
   }
-  
+
 }