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.model.NotConnectedException;
11 import com.quantum.util.connection.ConnectionUtil;
16 public abstract class BaseSQLPage extends WizardPage implements SQLPage {
19 protected Column[] columns;
20 // protected SQLResultSetResults results;
21 private ConnectionUtil connectionUtil = new ConnectionUtil();
23 public BaseSQLPage(String pageName) {
26 public boolean performFinish() {
27 // Bookmark bookmark = (Bookmark) this.results.getConnectable();
29 // bookmark.addQuery(getQueryText());
30 // SQLResults sqlResults = MultiSQLServer.getInstance().execute(bookmark,
31 // this.connectionUtil.getConnection(bookmark, getShell()), getQueryText());
32 // return sqlResults == null ? false : true;
33 // } catch (SQLException e) {
34 // SQLExceptionDialog.openException(getShell(), bookmark, e);
40 protected abstract String getQueryText();
41 protected void appendColumn(StringBuffer whereClause, Entity entity, String columnName, DatabaseAdapter adapter, String value) {
43 if (adapter != null && entity != null && getColumn(entity, columnName) != null) {
44 Column column = getColumn(entity, columnName);
45 whereClause.append(adapter.quote(value, column.getType(), column.getTypeName()));
47 whereClause.append(value);
54 * @throws NotConnectedException
55 * @throws SQLException
57 protected Column getColumn(Entity entity, String columnName) {
59 return entity == null ? null : entity.getColumn(columnName);
60 } catch (NotConnectedException e) {
62 } catch (SQLException e) {
66 public void init(Row row, Column[] columns) {
67 // this.results = results;
69 this.columns = columns;