use of org.jkiss.dbeaver.model.struct.DBSDataType in project dbeaver by serge-rider.
the class OracleTableColumnManager method createDatabaseObject.
@Override
protected OracleTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, OracleTableBase parent, Object copyFrom) {
//$NON-NLS-1$
DBSDataType columnType = findBestDataType(parent.getDataSource(), "varchar2");
final OracleTableColumn column = new OracleTableColumn(parent);
column.setName(getNewColumnName(monitor, context, parent));
column.setDataType((OracleDataType) columnType);
//$NON-NLS-1$
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;
}
use of org.jkiss.dbeaver.model.struct.DBSDataType in project dbeaver by serge-rider.
the class ArrayAttributeTransformer method transformAttribute.
@Override
public void transformAttribute(@NotNull DBCSession session, @NotNull DBDAttributeBinding attribute, @NotNull List<Object[]> rows, @NotNull Map<String, String> options) throws DBException {
DBSDataType collectionType;
if (attribute.getAttribute() instanceof DBSTypedObjectEx) {
collectionType = ((DBSTypedObjectEx) attribute.getAttribute()).getDataType();
} else {
collectionType = DBUtils.resolveDataType(session.getProgressMonitor(), session.getDataSource(), attribute.getTypeName());
}
if (collectionType != null) {
DBSDataType componentType = collectionType.getComponentType(session.getProgressMonitor());
if (componentType instanceof DBSEntity) {
ComplexTypeAttributeTransformer.createNestedTypeBindings(session, attribute, rows, (DBSEntity) componentType);
return;
}
}
// No component type found.
// Array items should be resolved in a lazy mode
MapAttributeTransformer.resolveMapsFromData(session, attribute, rows);
}
use of org.jkiss.dbeaver.model.struct.DBSDataType in project dbeaver by serge-rider.
the class GenericTableColumnManager method createDatabaseObject.
@Override
protected GenericTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, GenericTable parent, Object copyFrom) {
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;
}
use of org.jkiss.dbeaver.model.struct.DBSDataType in project dbeaver by serge-rider.
the class JDBCBasicDataTypeCache method fillStandardTypes.
// SQL-92 standard types
// plus a few de-facto standard types
@SuppressWarnings("unchecked")
public void fillStandardTypes(DBSObject owner) {
List<DBSDataType> standardTypes = new ArrayList<>();
Collections.addAll(standardTypes, new JDBCDataType(owner, Types.INTEGER, "INTEGER", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.FLOAT, "FLOAT", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.REAL, "REAL", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.DOUBLE, "DOUBLE PRECISION", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.NUMERIC, "NUMBER", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.DECIMAL, "DECIMAL", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.SMALLINT, "SMALLINT", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.BIGINT, "BIGINT", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.BIT, "BIT", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.VARCHAR, "VARCHAR", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.VARBINARY, "VARBINARY", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.DATE, "DATE", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.TIME, "TIME", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.TIMESTAMP, "TIMESTAMP", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.BLOB, "BLOB", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.CLOB, "CLOB", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.BOOLEAN, "BOOLEAN", null, false, true, 0, 0, 0), new JDBCDataType(owner, Types.OTHER, "OBJECT", null, false, true, 0, 0, 0));
setCache(standardTypes);
}
use of org.jkiss.dbeaver.model.struct.DBSDataType in project dbeaver by dbeaver.
the class OracleTableColumnManager method createDatabaseObject.
@Override
protected OracleTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, OracleTableBase parent, Object copyFrom) {
// $NON-NLS-1$
DBSDataType columnType = findBestDataType(parent.getDataSource(), "varchar2");
final OracleTableColumn column = new OracleTableColumn(parent);
column.setName(getNewColumnName(monitor, context, parent));
column.setDataType((OracleDataType) columnType);
// $NON-NLS-1$
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;
}
Aggregations