提交 34099490 编写于 作者: S serge-rider

#4388 Redshift table/column model


Former-commit-id: 420e9492
上级 fa75325b
......@@ -509,7 +509,7 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
protected PostgreTableColumn fetchChild(@NotNull JDBCSession session, @NotNull PostgreSchema owner, @NotNull PostgreTableBase table, @NotNull JDBCResultSet dbResult)
throws SQLException, DBException {
try {
return new PostgreTableColumn(session.getProgressMonitor(), table, dbResult);
return owner.getDataSource().getServerType().createTableColumn(session.getProgressMonitor(), PostgreSchema.this, table, dbResult);
} catch (DBException e) {
log.warn("Error reading attribute info", e);
return null;
......
......@@ -79,4 +79,5 @@ public interface PostgreServerExtension
String getTableModifiers(DBRProgressMonitor monitor, PostgreTableBase tableBase, boolean alter);
PostgreTableColumn createTableColumn(DBRProgressMonitor monitor, PostgreSchema schema, PostgreTableBase table, JDBCResultSet dbResult) throws DBException;
}
......@@ -241,6 +241,11 @@ public abstract class PostgreServerExtensionBase implements PostgreServerExtensi
return ddl.toString();
}
@Override
public PostgreTableColumn createTableColumn(DBRProgressMonitor monitor, PostgreSchema schema, PostgreTableBase table, JDBCResultSet dbResult) throws DBException {
return new PostgreTableColumn(monitor, table, dbResult);
}
public String createWithClause(PostgreTableRegular table, PostgreTableBase tableBase) {
StringBuilder withClauseBuilder = new StringBuilder();
......
......@@ -151,6 +151,20 @@ public class PostgreServerRedshift extends PostgreServerExtensionBase {
throw new DBException(e, table.getDataSource());
}
}
public PostgreTableBase createRelationOfClass(PostgreSchema schema, PostgreClass.RelKind kind, JDBCResultSet dbResult) {
if (kind == PostgreClass.RelKind.r) {
return new RedshiftTable(schema, dbResult);
}
return super.createRelationOfClass(schema, kind, dbResult);
}
@Override
public PostgreTableColumn createTableColumn(DBRProgressMonitor monitor, PostgreSchema schema, PostgreTableBase table, JDBCResultSet dbResult) throws DBException {
if (table instanceof RedshiftTable) {
return new RedshiftTableColumn(monitor, (RedshiftTable)table, dbResult);
}
return super.createTableColumn(monitor, schema, table, dbResult);
}
@Override
public PostgreDatabase.SchemaCache createSchemaCache(PostgreDatabase database) {
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.postgresql.model.impls.redshift;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreTableRegular;
import java.sql.ResultSet;
/**
* RedshiftTable base
*/
public class RedshiftTable extends PostgreTableRegular
{
private static final Log log = Log.getLog(RedshiftTable.class);
public RedshiftTable(PostgreSchema catalog) {
super(catalog);
}
public RedshiftTable(PostgreSchema catalog, ResultSet dbResult) {
super(catalog, dbResult);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.postgresql.model.impls.redshift;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreTableColumn;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
/**
* RedshiftTableColumn base
*/
public class RedshiftTableColumn extends PostgreTableColumn
{
public RedshiftTableColumn(RedshiftTable table) {
super(table);
}
public RedshiftTableColumn(DBRProgressMonitor monitor, RedshiftTable table, JDBCResultSet dbResult) throws DBException {
super(monitor, table, dbResult);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册