Example #1
0
        internal void Populate(
            ConnectorTypeMapper typeMapper, string name, uint tableOID, short columnAttributeNumber,
            uint oid, short typeSize, int typeModifier, FormatCode formatCode
            )
        {
            _typeMapper           = typeMapper;
            Name                  = name;
            TableOID              = tableOID;
            ColumnAttributeNumber = columnAttributeNumber;
            TypeOID               = oid;
            TypeSize              = typeSize;
            TypeModifier          = typeModifier;
            FormatCode            = formatCode;

            RealHandler = typeMapper.GetByOID(TypeOID);
            ResolveHandler();
        }
Example #2
0
        public override async ValueTask <object[]> Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription?fieldDescription = null)
        {
            await buf.Ensure(4, async);

            var fieldCount = buf.ReadInt32();
            var result     = new object[fieldCount];

            for (var i = 0; i < fieldCount; i++)
            {
                await buf.Ensure(8, async);

                var typeOID  = buf.ReadUInt32();
                var fieldLen = buf.ReadInt32();
                if (fieldLen == -1)  // Null field, simply skip it and leave at default
                {
                    continue;
                }
                result[i] = await _typeMapper.GetByOID(typeOID).ReadAsObject(buf, fieldLen, async);
            }

            return(result);
        }