Npgsql.Schema.DbColumnSchemaGenerator.ColumnPostConfig C# (CSharp) Method

ColumnPostConfig() private method

Performs some post-setup configuration that's common to both table columns and non-columns.
private ColumnPostConfig ( Npgsql.Schema.NpgsqlDbColumn column, int typeModifier ) : void
column Npgsql.Schema.NpgsqlDbColumn
typeModifier int
return void
        void ColumnPostConfig(NpgsqlDbColumn column, int typeModifier)
        {
            TypeHandler handler;
            column.DataType = _connection.Connector.TypeHandlerRegistry.TryGetByOID(column.TypeOID, out handler)
                ? handler.GetFieldType()
                : null;

            if (column.DataType != null)
            {
                column.IsLong = handler is ByteaHandler;

                if (handler is ICompositeHandler)
                    column.UdtAssemblyQualifiedName = column.DataType.AssemblyQualifiedName;
            }

            if (typeModifier == -1)
                return;

            switch (column.DataTypeName)
            {
            case "bpchar":
            case "char":
            case "varchar":
                column.ColumnSize = typeModifier - 4;
                break;
            case "numeric":
            case "decimal":
                // See http://stackoverflow.com/questions/3350148/where-are-numeric-precision-and-scale-for-a-field-found-in-the-pg-catalog-tables
                column.NumericPrecision = ((typeModifier - 4) >> 16) & 65535;
                column.NumericScale = (typeModifier - 4) & 65535;
                break;
            }
        }
    }