Search in sources :

Example 6 with GenericTableBase

use of org.jkiss.dbeaver.ext.generic.model.GenericTableBase in project dbeaver by serge-rider.

the class GenericViewManager method createDatabaseObject.

@Override
protected GenericTableBase createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, Object container, Object copyFrom, Map<String, Object> options) {
    GenericStructContainer structContainer = (GenericStructContainer) container;
    String tableName = getNewChildName(monitor, structContainer, SQLTableManager.BASE_VIEW_NAME);
    GenericTableBase viewImpl = structContainer.getDataSource().getMetaModel().createTableImpl(structContainer, tableName, GenericConstants.TABLE_TYPE_VIEW, null);
    if (viewImpl instanceof GenericView) {
        ((GenericView) viewImpl).setObjectDefinitionText("CREATE VIEW " + viewImpl.getFullyQualifiedName(DBPEvaluationContext.DDL) + " AS SELECT 1 as A\n");
    }
    return viewImpl;
}
Also used : GenericStructContainer(org.jkiss.dbeaver.ext.generic.model.GenericStructContainer) GenericView(org.jkiss.dbeaver.ext.generic.model.GenericView) GenericTableBase(org.jkiss.dbeaver.ext.generic.model.GenericTableBase)

Aggregations

GenericTableBase (org.jkiss.dbeaver.ext.generic.model.GenericTableBase)6 GenericTableColumn (org.jkiss.dbeaver.ext.generic.model.GenericTableColumn)2 SQLException (java.sql.SQLException)1 DBException (org.jkiss.dbeaver.DBException)1 GenericStructContainer (org.jkiss.dbeaver.ext.generic.model.GenericStructContainer)1 GenericTableForeignKey (org.jkiss.dbeaver.ext.generic.model.GenericTableForeignKey)1 GenericTableIndex (org.jkiss.dbeaver.ext.generic.model.GenericTableIndex)1 GenericTableIndexColumn (org.jkiss.dbeaver.ext.generic.model.GenericTableIndexColumn)1 GenericView (org.jkiss.dbeaver.ext.generic.model.GenericView)1 DBCException (org.jkiss.dbeaver.model.exec.DBCException)1 DBCSession (org.jkiss.dbeaver.model.exec.DBCSession)1 JDBCPreparedStatement (org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement)1 JDBCResultSet (org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet)1 JDBCSession (org.jkiss.dbeaver.model.exec.jdbc.JDBCSession)1 SQLDatabasePersistAction (org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)1 SQLDatabasePersistActionComment (org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistActionComment)1 DBSDataType (org.jkiss.dbeaver.model.struct.DBSDataType)1 DBSEntityAttribute (org.jkiss.dbeaver.model.struct.DBSEntityAttribute)1 DBSIndexType (org.jkiss.dbeaver.model.struct.rdb.DBSIndexType)1 EditIndexPage (org.jkiss.dbeaver.ui.editors.object.struct.EditIndexPage)1