protected override object ReadNext() { if (_nullMap.IsNull(CurrentField)) { return(DBNull.Value); } NpgsqlRowDescription.FieldData field_descr = FieldData; Int32 field_value_size = PGUtil.ReadInt32(Stream) - 4; byte[] buffer = new byte[field_value_size]; PGUtil.CheckedStreamRead(Stream, buffer, 0, field_value_size); char[] charBuffer = new char[UTF8Encoding.GetCharCount(buffer, 0, buffer.Length)]; UTF8Encoding.GetChars(buffer, 0, buffer.Length, charBuffer, 0); try { return (NpgsqlTypesHelper.ConvertBackendStringToSystemType(field_descr.TypeInfo, new string(charBuffer), field_descr.TypeSize, field_descr.TypeModifier)); } catch (InvalidCastException ice) { return(ice); } catch (Exception ex) { return(new InvalidCastException(ex.Message, ex)); } }
protected override object ReadNext() { if (_nullMap.IsNull(CurrentField)) { return(DBNull.Value); } NpgsqlRowDescription.FieldData field_descr = FieldData; Int32 field_value_size = PGUtil.ReadInt32(Stream) - 4; if (field_value_size >= 85000) { return(ReadLargeObject(field_descr, field_value_size)); } byte[] buffer = new byte[field_value_size]; PGUtil.CheckedStreamRead(Stream, buffer, 0, field_value_size); var str = UTF8Encoding.GetString(buffer); try { return (NpgsqlTypesHelper.ConvertBackendStringToSystemType( field_descr.TypeInfo, str, field_descr.TypeSize, field_descr.TypeModifier)); } catch (InvalidCastException ice) { return(ice); } catch (Exception ex) { return(new InvalidCastException(ex.Message, ex)); } }