Search in sources :

Example 1 with MySQLView

use of org.jkiss.dbeaver.ext.mysql.model.MySQLView in project dbeaver by serge-rider.

the class MySQLViewManager method createDatabaseObject.

@Override
protected MySQLView createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, MySQLCatalog parent, Object copyFrom) {
    MySQLView newCatalog = new MySQLView(parent);
    //$NON-NLS-1$
    newCatalog.setName("NewView");
    return newCatalog;
}
Also used : MySQLView(org.jkiss.dbeaver.ext.mysql.model.MySQLView)

Example 2 with MySQLView

use of org.jkiss.dbeaver.ext.mysql.model.MySQLView in project dbeaver by serge-rider.

the class MySQLViewManager method createOrReplaceViewQuery.

private void createOrReplaceViewQuery(List<DBEPersistAction> actions, MySQLView view) {
    StringBuilder decl = new StringBuilder(200);
    final String lineSeparator = GeneralUtils.getDefaultLineSeparator();
    //$NON-NLS-1$
    decl.append("CREATE OR REPLACE VIEW ").append(view.getFullyQualifiedName(DBPEvaluationContext.DDL)).append(lineSeparator).append("AS ").append(//$NON-NLS-1$
    view.getAdditionalInfo().getDefinition());
    final MySQLView.CheckOption checkOption = view.getAdditionalInfo().getCheckOption();
    if (checkOption != null && checkOption != MySQLView.CheckOption.NONE) {
        //$NON-NLS-1$ //$NON-NLS-2$
        decl.append(lineSeparator).append("WITH ").append(checkOption.getDefinitionName()).append(" CHECK OPTION");
    }
    actions.add(new SQLDatabasePersistAction("Create view", decl.toString()));
}
Also used : MySQLView(org.jkiss.dbeaver.ext.mysql.model.MySQLView) SQLDatabasePersistAction(org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)

Aggregations

MySQLView (org.jkiss.dbeaver.ext.mysql.model.MySQLView)2 SQLDatabasePersistAction (org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction)1