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

Generic table column create fix

上级 f232f960
......@@ -196,8 +196,8 @@ public class FireBirdMetaModel extends GenericMetaModel
}
@Override
public GenericTableColumn createTableColumnImpl(JDBCSession session, JDBCResultSet dbResult, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
return new FireBirdTableColumn(session, table,
public GenericTableColumn createTableColumnImpl(DBRProgressMonitor monitor, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
return new FireBirdTableColumn(monitor, table,
columnName,
typeName, valueType, sourceType, ordinalPos,
columnSize,
......
......@@ -41,10 +41,10 @@ public class FireBirdTableColumn extends GenericTableColumn {
super(table);
}
public FireBirdTableColumn(JDBCSession session, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPosition, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
public FireBirdTableColumn(DBRProgressMonitor monitor, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPosition, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
super(table, columnName, typeName, valueType, sourceType, ordinalPosition, columnSize, charLength, scale, precision, radix, notNull, remarks, defaultValue, autoIncrement, autoGenerated);
if (typeName.equals("CHAR") || typeName.equals("VARCHAR")) {
getDomainTypeName(session.getProgressMonitor());
getDomainTypeName(monitor);
}
if (domainTypeName != null) {
dataType = (FireBirdDataType) table.getDataSource().getLocalDataType(domainTypeName);
......
......@@ -18,6 +18,7 @@
package org.jkiss.dbeaver.ext.generic.edit;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.generic.GenericConstants;
import org.jkiss.dbeaver.ext.generic.model.GenericTable;
import org.jkiss.dbeaver.ext.generic.model.GenericTableColumn;
......@@ -48,17 +49,29 @@ public class GenericTableColumnManager extends SQLTableColumnManager<GenericTabl
}
@Override
protected GenericTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, GenericTable parent, Object copyFrom)
{
protected GenericTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, GenericTable parent, Object copyFrom) throws DBException {
DBSDataType columnType = findBestDataType(parent.getDataSource(), DBConstants.DEFAULT_DATATYPE_NAMES);
final GenericTableColumn column = new GenericTableColumn(parent);
column.setName(getNewColumnName(monitor, context, parent));
column.setTypeName(columnType == null ? "INTEGER" : columnType.getName());
column.setMaxLength(columnType != null && columnType.getDataKind() == DBPDataKind.STRING ? 100 : 0);
column.setValueType(columnType == null ? Types.INTEGER : columnType.getTypeID());
column.setOrdinalPosition(-1);
return column;
int columnSize = columnType != null && columnType.getDataKind() == DBPDataKind.STRING ? 100 : 0;
return parent.getDataSource().getMetaModel().createTableColumnImpl(
monitor,
parent,
getNewColumnName(monitor, context, parent),
columnType == null ? "INTEGER" : columnType.getName(),
columnType == null ? Types.INTEGER : columnType.getTypeID(),
columnType == null ? Types.INTEGER : columnType.getTypeID(),
-1,
columnSize,
columnSize,
null,
null,
10,
false,
null,
null,
false,
false
);
}
@Override
......
......@@ -187,7 +187,6 @@ public class TableCache extends JDBCStructLookupCache<GenericStructContainer, Ge
return getDataSource().getMetaModel().createTableColumnImpl(
session,
dbResult,
table,
columnName,
typeName, valueType, sourceType, ordinalPos,
......
......@@ -423,7 +423,7 @@ public class GenericMetaModel {
//////////////////////////////////////////////////////
// Table columns
public GenericTableColumn createTableColumnImpl(JDBCSession session, JDBCResultSet dbResult, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
public GenericTableColumn createTableColumnImpl(DBRProgressMonitor monitor, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
return new GenericTableColumn(table,
columnName,
typeName, valueType, sourceType, ordinalPos,
......
......@@ -156,7 +156,7 @@ public class SQLiteMetaModel extends GenericMetaModel implements DBCQueryTransfo
}
@Override
public GenericTableColumn createTableColumnImpl(JDBCSession session, JDBCResultSet dbResult, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) {
public GenericTableColumn createTableColumnImpl(DBRProgressMonitor monitor, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) {
return new SQLiteTableColumn(table, columnName, typeName, valueType, sourceType, ordinalPos, columnSize, charLength, scale, precision, radix, notNull, remarks, defaultValue, autoIncrement, autoGenerated);
}
}
......@@ -93,7 +93,7 @@ public class VerticaMetaModel extends GenericMetaModel implements DBCQueryTransf
}
@Override
public GenericTableColumn createTableColumnImpl(JDBCSession session, JDBCResultSet dbResult, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
public GenericTableColumn createTableColumnImpl(DBRProgressMonitor monitor, GenericTable table, String columnName, String typeName, int valueType, int sourceType, int ordinalPos, long columnSize, long charLength, Integer scale, Integer precision, int radix, boolean notNull, String remarks, String defaultValue, boolean autoIncrement, boolean autoGenerated) throws DBException {
return new VerticaTableColumn(table,
columnName,
typeName, valueType, sourceType, ordinalPos,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册