Search in sources :

Example 1 with GenericStructContainer

use of org.jkiss.dbeaver.ext.generic.model.GenericStructContainer in project dbeaver by dbeaver.

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)

Example 2 with GenericStructContainer

use of org.jkiss.dbeaver.ext.generic.model.GenericStructContainer 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

GenericStructContainer (org.jkiss.dbeaver.ext.generic.model.GenericStructContainer)2 GenericTableBase (org.jkiss.dbeaver.ext.generic.model.GenericTableBase)2 GenericView (org.jkiss.dbeaver.ext.generic.model.GenericView)2