package com.quantum.wizards;
+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.TableRow;
import com.quantum.view.ViewHelper;
import com.quantum.view.tableview.TableAdapter;
}
protected abstract String getQueryText();
protected void appendColumn(StringBuffer whereClause, Entity entity, String columnName, DatabaseAdapter adapter, String value) {
-
- if (adapter != null && entity != null && entity.getColumn(columnName) != null) {
- Column column = entity.getColumn(columnName);
+
+ if (adapter != null && entity != null && getColumn(entity, columnName) != null) {
+ Column column = getColumn(entity, columnName);
whereClause.append(adapter.quote(value, column.getType(), column.getTypeName()));
} else {
whereClause.append(value);
}
}
- public void init(TableRow row, TableAdapter adapter) {
+ /**
+ * @param entity
+ * @param columnName
+ * @return
+ * @throws NotConnectedException
+ * @throws SQLException
+ */
+ protected Column getColumn(Entity entity, String columnName) {
+ try {
+ return entity == null ? null : entity.getColumn(columnName);
+ } catch (NotConnectedException e) {
+ return null;
+ } catch (SQLException e) {
+ return null;
+ }
+ }
+ public void init(TableRow row, TableAdapter adapter) {
this.row = row;
this.adapter = adapter;
}