internal static ClickHouseType[] GetClickHouseColumnTypes(this ClickHouseDataReader reader) { var count = reader.FieldCount; var names = new ClickHouseType[count]; for (int i = 0; i < count; i++) { names[i] = reader.GetClickHouseType(i); } return(names); }
private static object[] DescribeColumn(this ClickHouseDataReader reader, int ordinal) { var chType = reader.GetClickHouseType(ordinal); var result = new object[Columns.Length]; result[0] = reader.GetName(ordinal); // ColumnName result[1] = ordinal; // ColumnOrdinal result[2] = null; // ColumnSize result[3] = null; // NumericPrecision result[4] = null; // NumericScale result[5] = chType.FrameworkType; // DataType result[6] = chType.ToString(); // ProviderType result[7] = chType.TypeCode == ClickHouseTypeCode.String; // IsLong result[8] = chType.TypeCode == ClickHouseTypeCode.Nullable; // AllowDBNull result[9] = true; // IsReadOnly result[10] = false; // IsRowVersion result[11] = false; // IsUnique result[12] = false; // IsKey result[13] = false; // IsAutoIncrement result[14] = null; // BaseCatalogName result[15] = null; // BaseSchemaName result[16] = null; // BaseTableName result[17] = reader.GetName(ordinal); // BaseColumnName result[18] = null; // AutoIncrementSeed result[19] = null; // AutoIncrementStep result[20] = null; // DefaultValue result[21] = null; // Expression result[22] = MappingType.Element; // ColumnMapping result[23] = null; // BaseTableNamespace result[24] = null; // BaseColumnNamespace if (chType is DecimalType dt) { result[2] = dt.Size; result[3] = dt.Precision; result[4] = dt.Scale; } return(result); }