Quantum version 2.4.1
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / BaseSQLPage.java
index a7a84fe..3c75b99 100644 (file)
@@ -5,13 +5,13 @@ import java.sql.SQLException;
 import com.quantum.adapters.DatabaseAdapter;
 import com.quantum.model.Bookmark;
 import com.quantum.model.Column;
-import com.quantum.model.ConnectionException;
 import com.quantum.model.Entity;
 import com.quantum.model.NotConnectedException;
+import com.quantum.sql.MultiSQLServer;
+import com.quantum.sql.SQLResultSetResults;
 import com.quantum.sql.SQLResults;
-import com.quantum.sql.TableRow;
-import com.quantum.view.ViewHelper;
-import com.quantum.view.tableview.TableAdapter;
+import com.quantum.ui.dialog.ExceptionDisplayDialog;
+import com.quantum.util.connection.ConnectionUtil;
 
 import org.eclipse.jface.wizard.WizardPage;
 
@@ -21,21 +21,22 @@ import org.eclipse.jface.wizard.WizardPage;
  */
 public abstract class BaseSQLPage extends WizardPage implements SQLPage {
 
-    protected TableRow row;
-    protected TableAdapter adapter;
+    protected SQLResultSetResults.Row row;
+       protected SQLResultSetResults results;
+       private ConnectionUtil connectionUtil = new ConnectionUtil();
 
     public BaseSQLPage(String pageName) {
         super(pageName);
     }
     public boolean performFinish() {
                try {
-                       Bookmark bookmark = this.adapter.getBookmark();
+                       Bookmark bookmark = this.results.getBookmark();
                        bookmark.addQuery(getQueryText());
-                       SQLResults sqlResults = ViewHelper.tryGetResults(getShell(),
-                                       bookmark.getConnection(), getQueryText());
-                       return sqlResults.isError() ? false : true;
-               } catch (ConnectionException e) {
-                       e.printStackTrace();
+                       SQLResults sqlResults = MultiSQLServer.getInstance().execute(bookmark, 
+                                       this.connectionUtil.getConnection(bookmark, getShell()), getQueryText());
+                       return sqlResults == null ? false : true;
+               } catch (SQLException e) {
+                       ExceptionDisplayDialog.openError(getShell(), null, null, e);
                        return false;
                }
        }
@@ -66,8 +67,8 @@ public abstract class BaseSQLPage extends WizardPage implements SQLPage {
                        return null;
                }
        }
-       public void init(TableRow row, TableAdapter adapter) {
-       this.row = row;
-        this.adapter = adapter;
+       public void init(SQLResultSetResults results, SQLResultSetResults.Row row) {
+       this.results = results;
+               this.row = row;
     }
 }