提交 d8c2a1e8 编写于 作者: J jurgen

Support short DROP COLUMN syntax for Sybase and Vertica

上级 07386e74
......@@ -117,14 +117,14 @@ public abstract class JDBCTableColumnManager<OBJECT_TYPE extends JDBCTableColumn
return FEATURE_EDITOR_ON_CREATE;
}
protected long getDDLFeatures()
protected long getDDLFeatures(OBJECT_TYPE object)
{
return 0;
}
private boolean hasDDLFeature(long feature)
private boolean hasDDLFeature(OBJECT_TYPE object, long feature)
{
return (getDDLFeatures() & feature) != 0;
return (getDDLFeatures(object) & feature) != 0;
}
@Override
......@@ -143,7 +143,7 @@ public abstract class JDBCTableColumnManager<OBJECT_TYPE extends JDBCTableColumn
return new IDatabasePersistAction[] {
new AbstractDatabasePersistAction(
CoreMessages.model_jdbc_drop_table_column, "ALTER TABLE " + command.getObject().getTable().getFullQualifiedName() + //$NON-NLS-2$
" DROP " + (hasDDLFeature(DDL_FEATURE_OMIT_COLUMN_CLAUSE_IN_DROP) ? "" : "COLUMN ") + DBUtils.getQuotedIdentifier(command.getObject())) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
" DROP " + (hasDDLFeature(command.getObject(), DDL_FEATURE_OMIT_COLUMN_CLAUSE_IN_DROP) ? "" : "COLUMN ") + DBUtils.getQuotedIdentifier(command.getObject())) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
}
......
......@@ -108,6 +108,9 @@
<property id="query-set-active-db" label="Set active database" description="Query to change active database" type="string" required="false" defaultValue=""/>
<property id="active-entity-type" label="Active object type" description="Type of selectable object (schema, catalog)" type="string" required="false" defaultValue="" validValues="catalog,schema"/>
</propertyGroup>
<propertyGroup label="DDL" description="DDL generation options">
<property id="ddl-drop-column-short" label="Drop column short syntax" description="Use 'ALTER TABLE DROP column-name' instead of standard syntax" type="boolean" required="false" defaultValue="false"/>
</propertyGroup>
</driver-properties>
<drivers managable="true">
......@@ -268,6 +271,7 @@
<!--parameter name="query-get-active-db">select db_name()</query>
<parameter name="query-set-active-db">use ?</query-->
<parameter name="script-delimiter" value="go"/>
<parameter name="ddl-drop-column-short" value="true"/>
<file type="jar" path="drivers/jtds/jtds-1.2.5.jar" url="*"/>
<file type="license" path="drivers/jtds/LICENSE.txt" url="*"/>
</driver>
......@@ -544,6 +548,7 @@
description="Driver for Vertica Database">
<file type="jar" path="drivers/vertica/vertica-jdk5-6.1.2-0.jar" url="*"/>
<parameter name="supports-limits" value="false"/>
<parameter name="ddl-drop-column-short" value="true"/>
</driver>
<driver
id="cassandra_jkiss"
......
......@@ -40,6 +40,7 @@ public class GenericConstants {
public static final String PARAM_ALL_OBJECTS_PATTERN = "all-objects-pattern";
public static final String PARAM_SCRIPT_DELIMITER = "script-delimiter";
public static final String PARAM_EMBEDDED = "embedded";
public static final String PARAM_DDL_DROP_COLUMN_SHORT = "ddl-drop-column-short";
public static final String ENTITY_TYPE_CATALOG = "catalog";
public static final String ENTITY_TYPE_SCHEMA = "schema";
......
......@@ -21,6 +21,7 @@ package org.jkiss.dbeaver.ext.generic.edit;
import org.eclipse.ui.IWorkbenchWindow;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.ext.generic.GenericConstants;
import org.jkiss.dbeaver.ext.generic.model.GenericTable;
import org.jkiss.dbeaver.ext.generic.model.GenericTableColumn;
import org.jkiss.dbeaver.model.DBConstants;
......@@ -31,6 +32,7 @@ import org.jkiss.dbeaver.model.impl.jdbc.edit.struct.JDBCTableColumnManager;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.utils.CommonUtils;
import java.sql.Types;
......@@ -60,4 +62,13 @@ public class GenericTableColumnManager extends JDBCTableColumnManager<GenericTab
return column;
}
@Override
protected long getDDLFeatures(GenericTableColumn object) {
long features = 0;
Object shortDrop = object.getDataSource().getContainer().getDriver().getDriverParameter(GenericConstants.PARAM_DDL_DROP_COLUMN_SHORT);
if (shortDrop != null && CommonUtils.toBoolean(shortDrop)) {
features |= DDL_FEATURE_OMIT_COLUMN_CLAUSE_IN_DROP;
}
return features;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册