use of io.mycat.hbt.ast.base.FieldType in project Mycat2 by MyCATApache.
the class FieldTypes method getFieldTypes.
@SneakyThrows
public static List<FieldType> getFieldTypes(MycatRowMetaData metaData) {
int columnCount = metaData.getColumnCount();
ArrayList<FieldType> fieldTypes = new ArrayList<>(columnCount);
for (int i = 0; i < columnCount; i++) {
final String columnName = metaData.getColumnName(i);
SqlTypeName sqlTypeName = Objects.requireNonNull(HBTCalciteSupport.INSTANCE.getSqlTypeByJdbcValue(metaData.getColumnType(i)), "type is not existed,类型不存在");
final String columnType = sqlTypeName.getName();
final boolean nullable = metaData.isNullable(i);
final Integer precision = metaData.getPrecision(i);
final Integer scale = metaData.getScale(i);
fieldTypes.add(new FieldType(columnName, columnType, nullable, precision, scale));
}
return fieldTypes;
}
Aggregations