removed the hardly used adaptor stuff. improved config checking on servlet initialization
[mir.git] / source / mir / storage / Database.java
index 7a3034e..95be661 100755 (executable)
@@ -76,7 +76,7 @@ import mir.util.JDBCStringRoutines;
  * Treiber, Host, User und Passwort, ueber den der Zugriff auf die
  * Datenbank erfolgt.
  *
- * @version $Id: Database.java,v 1.44.2.4 2003/06/23 15:24:06 zapata Exp $
+ * @version $Id: Database.java,v 1.44.2.5 2003/06/27 02:43:42 zapata Exp $
  * @author rk
  *
  */
@@ -116,7 +116,7 @@ public class Database implements StorageObject {
   private String database_driver;
   private String database_url;
   private int defaultLimit;
-  protected DatabaseAdaptor theAdaptor;
+
   TimeZone timezone;
   SimpleDateFormat internalDateFormat;
   SimpleDateFormat userInputDateFormat;
@@ -158,7 +158,6 @@ public class Database implements StorageObject {
 
     try {
       theEntityClass = GENERIC_ENTITY_CLASS;
-      theAdaptor = (DatabaseAdaptor) Class.forName(theAdaptorName).newInstance();
     }
     catch (Throwable e) {
       logger.error("Error in Database() constructor with " + theAdaptorName + " -- " + e.getMessage());
@@ -595,10 +594,8 @@ public class Database implements StorageObject {
       selectSql.append(" order by ").append(anOrderByClause);
     }
 
-    if (theAdaptor.hasLimit()) {
-      if ((limit > -1) && (offset > -1)) {
-        selectSql.append(" LIMIT ").append(limit).append(" OFFSET ").append(offset);
-      }
+    if ((limit > -1) && (offset > -1)) {
+      selectSql.append(" LIMIT ").append(limit).append(" OFFSET ").append(offset);
     }
 
     // execute sql
@@ -628,9 +625,7 @@ public class Database implements StorageObject {
       }
 
       // making entitylist infos
-      if (!(theAdaptor.hasLimit())) {
-        count = offsetCount;
-      }
+      count = offsetCount;
 
       if (theReturnList != null) {
         // now we decide if we have to know an overall count...
@@ -870,7 +865,7 @@ public class Database implements StorageObject {
         return null;
       }
 
-      pstmt = con.prepareStatement(theAdaptor.getLastInsertSQL(this));
+      pstmt = con.prepareStatement("select currval('" + getCoreTable() + "_id_seq')");
 
       ResultSet rs = pstmt.executeQuery();
       rs.next();