1 package net.sourceforge.phpeclipse.wizards.actions.metadata;
3 import java.sql.SQLException;
5 import org.eclipse.jface.wizard.WizardPage;
7 import com.quantum.adapters.DatabaseAdapter;
8 import com.quantum.model.Column;
9 import com.quantum.model.Entity;
10 import com.quantum.sql.SQLResultSetResults;
11 import com.quantum.ui.dialog.ConnectionUtil;
12 import com.quantum.util.connection.NotConnectedException;
17 public abstract class BaseSQLPage extends WizardPage implements SQLPage {
20 protected Column[] columns;
21 // protected SQLResultSetResults results;
22 private ConnectionUtil connectionUtil = new ConnectionUtil();
24 public BaseSQLPage(String pageName) {
27 public boolean performFinish() {
28 // Bookmark bookmark = (Bookmark) this.results.getConnectable();
30 // bookmark.addQuery(getQueryText());
31 // SQLResults sqlResults = MultiSQLServer.getInstance().execute(bookmark,
32 // this.connectionUtil.getConnection(bookmark, getShell()), getQueryText());
33 // return sqlResults == null ? false : true;
34 // } catch (SQLException e) {
35 // SQLExceptionDialog.openException(getShell(), bookmark, e);
41 protected abstract String getQueryText();
42 protected void appendColumn(StringBuffer whereClause, Entity entity, String columnName, DatabaseAdapter adapter, String value) {
44 if (adapter != null && entity != null && getColumn(entity, columnName) != null) {
45 Column column = getColumn(entity, columnName);
46 whereClause.append(adapter.quote(value, column.getType(), column.getTypeName()));
48 whereClause.append(value);
55 * @throws NotConnectedException
56 * @throws SQLException
58 protected Column getColumn(Entity entity, String columnName) {
60 return entity == null ? null : entity.getColumn(columnName);
61 } catch (NotConnectedException e) {
63 } catch (SQLException e) {
67 public void init(Row row, Column[] columns) {
68 // this.results = results;
70 this.columns = columns;