From 3ffdd9d58b8b53c0ab5dba58747f7631fa568e74 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 8 Feb 2002 13:39:39 +0000 Subject: [PATCH] coding style cleanup. --- source/mir/storage/Database.java | 48 +++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/source/mir/storage/Database.java b/source/mir/storage/Database.java index 6728e404..e46db2e8 100755 --- a/source/mir/storage/Database.java +++ b/source/mir/storage/Database.java @@ -795,7 +795,9 @@ public class Database implements StorageObject { Connection con = null; Statement stmt = null; // build sql - StringBuffer sql = new StringBuffer("select ").append(thePKeyName).append(",").append(name).append(" from ").append(theTable); + StringBuffer sql = new StringBuffer("select ").append(thePKeyName) + .append(",").append(name).append(" from ") + .append(theTable); if (where != null && !(where.length() == 0)) sql.append(" where ").append(where); sql.append(" order by "); @@ -885,8 +887,8 @@ public class Database implements StorageObject { } catch (SQLException e) { - theLog.printDebugInfo("Failed: " + (new java.util.Date().getTime() - startTime) + "ms. for: " - + sql); + theLog.printDebugInfo("Failed: " + (new java.util.Date().getTime() + - startTime) + "ms. for: "+ sql); throw e; } @@ -900,8 +902,8 @@ public class Database implements StorageObject { * @return Liefert ResultSet des Statements zurueck. * @exception StorageObjectException, SQLException */ - public ResultSet executeSql (PreparedStatement stmt) throws StorageObjectException, - SQLException { + public ResultSet executeSql (PreparedStatement stmt) + throws StorageObjectException, SQLException { long startTime = (new java.util.Date()).getTime(); ResultSet rs = stmt.executeQuery(); @@ -935,7 +937,8 @@ public class Database implements StorageObject { freeConnection(con,stmt); } theLog.printInfo(theTable + " has "+ result +" rows where " + where); - theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + sql); + theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + + sql); return result; } @@ -947,12 +950,13 @@ public class Database implements StorageObject { try { rs = stmt.executeUpdate(sql); - theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + sql); + theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + + sql); } catch (SQLException e) { - theLog.printDebugInfo("Failed: " + (new java.util.Date().getTime() - startTime) + "ms. for: " - + sql); + theLog.printDebugInfo("Failed: " + (new java.util.Date().getTime() + - startTime) + "ms. for: "+ sql); throw e; } return rs; @@ -974,7 +978,8 @@ public class Database implements StorageObject { throw new StorageObjectException("executeUpdate failed: "+e.toString()); } finally { freeConnection(con,pstmt); } - theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + sql); + theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + + sql); return result; } @@ -983,7 +988,9 @@ public class Database implements StorageObject { * @param md ResultSetMetaData * @exception StorageObjectException */ - private void evalMetaData (ResultSetMetaData md) throws StorageObjectException { + private void evalMetaData (ResultSetMetaData md) + throws StorageObjectException { + this.evaluatedMetaData = true; this.metadataFields = new ArrayList(); this.metadataLabels = new ArrayList(); @@ -1035,11 +1042,12 @@ public class Database implements StorageObject { public Connection getPooledCon() throws StorageObjectException { - try{ + /*try{ Class.forName("com.codestudio.sql.PoolMan").newInstance(); } catch (Exception e){ - throw new StorageObjectException("Could not find the PoolMan Driver"+e.toString()); - } + throw new StorageObjectException("Could not find the PoolMan Driver" + +e.toString()); + }*/ Connection con = null; try{ con = SQLManager.getInstance().requestConnection(); @@ -1061,7 +1069,8 @@ public class Database implements StorageObject { * @param wo Funktonsname, in der die SQLException geworfen wurde * @exception StorageObjectException */ - protected void throwSQLException (SQLException sqe, String wo) throws StorageObjectException { + protected void throwSQLException (SQLException sqe, String wo) + throws StorageObjectException { String state = ""; String message = ""; int vendor = 0; @@ -1076,7 +1085,8 @@ public class Database implements StorageObject { sqe.toString()); } - protected void _throwStorageObjectException (Exception e, String wo) throws StorageObjectException { + protected void _throwStorageObjectException (Exception e, String wo) + throws StorageObjectException { if (e != null) { theLog.printError(e.toString()+ wo); throw new StorageObjectException(wo + e.toString()); @@ -1088,11 +1098,13 @@ public class Database implements StorageObject { } /** - * Loggt Fehlermeldung mit dem Parameter Message und wirft dannach eine StorageObjectException + * Loggt Fehlermeldung mit dem Parameter Message und wirft dannach + * eine StorageObjectException * @param message Nachricht mit dem Fehler * @exception StorageObjectException */ - void throwStorageObjectException (String message) throws StorageObjectException { + void throwStorageObjectException (String message) + throws StorageObjectException { _throwStorageObjectException(null, message); } -- 2.11.0