Initial implementation
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / sql / MultiSQLServer.java
index 4946bf6..97c1cc1 100644 (file)
@@ -87,22 +87,6 @@ public class MultiSQLServer implements ConnectionEstablisher {
         }
     }
 
-    public Vector getSchemas(Connection con) {
-        ResultSet set;
-        Vector schemaList = new Vector();
-        try {
-            DatabaseMetaData meta = con.getMetaData();
-            set = meta.getSchemas();
-            while (set.next()) {
-                schemaList.add(set.getString("TABLE_SCHEM")); //$NON-NLS-1$
-            }
-            set.close();
-        } catch (SQLException e) {
-            LogProxy log = LogProxy.getInstance();
-            log.addText(LogProxy.ERROR, e);
-        }
-        return schemaList;
-    }
     /**
      * Makes a connection to a JDBC driver based on the data from a bookmark
      * @param bookmark - 
@@ -122,17 +106,19 @@ public class MultiSQLServer implements ConnectionEstablisher {
                 bookmark.setPassword(password);
             }
         }
-               Connection con;
+        
         if (password != null) {
-            con = connect(bookmark, password);
+            Connection connection = connect(bookmark, password);
+            if (connection != null) {
+                       // Set the autoCommit state of the bookmark to the default on new connections
+                               bookmark.setAutoCommit(bookmark.getDefaultAutoCommit());
+                               // Set the autoCommit state of the JDBC connection to the bookmark autoCommit statec
+                       setAutoCommit(connection, bookmark.isAutoCommit());
+            }
+               return connection;
         } else {
             return null;
         }
-        // Set the autoCommit state of the bookmark to the default on new connections
-               bookmark.setAutoCommit(bookmark.getDefaultAutoCommit());
-               // Set the autoCommit state of the JDBC connection to the bookmark autoCommit statec
-               setAutoCommit(con, bookmark.isAutoCommit());
-               return con;
         
     }
     private Connection connect(Bookmark bookmark, String password)
@@ -186,6 +172,7 @@ public class MultiSQLServer implements ConnectionEstablisher {
 
                SQLResults results = new SQLResults();
 
+               long startTime = System.currentTimeMillis();
                System.out.println("Executing"); //$NON-NLS-1$
                LogProxy log = LogProxy.getInstance();
                log.addText(LogProxy.QUERY, "Executing Request [" + s + "]"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -329,6 +316,7 @@ public class MultiSQLServer implements ConnectionEstablisher {
                }
                log.addText(LogProxy.RESULTS, "Success: result set displayed"); //$NON-NLS-1$
                stmt.close();
+               results.setTime(System.currentTimeMillis() - startTime);
                System.out.println("Executed"); //$NON-NLS-1$
                System.out.println();
                return results;