1 package com.quantum.wizards;
3 import com.quantum.adapters.DatabaseAdapter;
4 import com.quantum.model.Bookmark;
5 import com.quantum.model.Column;
6 import com.quantum.model.ConnectionException;
7 import com.quantum.model.Entity;
8 import com.quantum.sql.TableRow;
9 import com.quantum.view.ViewHelper;
10 import com.quantum.view.tableview.TableAdapter;
12 import org.eclipse.jface.wizard.WizardPage;
17 public abstract class BaseSQLPage extends WizardPage implements SQLPage {
19 protected TableRow row;
20 protected TableAdapter adapter;
22 public BaseSQLPage(String pageName) {
25 public boolean performFinish() {
27 Bookmark bookmark = this.adapter.getBookmark();
28 bookmark.addQuery(getQueryText());
29 ViewHelper.tryGetResults(getShell(), bookmark.getConnection(), getQueryText());
30 } catch (ConnectionException e) {
35 protected abstract String getQueryText();
36 protected void appendColumn(StringBuffer whereClause, Entity entity, String columnName, DatabaseAdapter adapter, String value) {
38 if (adapter != null && entity != null && entity.getColumn(columnName) != null) {
39 Column column = entity.getColumn(columnName);
40 whereClause.append(adapter.quote(value, column.getType(), column.getTypeName()));
42 whereClause.append(value);
45 public void init(TableRow row, TableAdapter adapter) {
47 this.adapter = adapter;