public RecordFileReader(SqlBytes data) { if (data.IsNull) { throw new InvalidDataException(SR.EmptyFile); } this._reader = new SqlBytesReader(data); }
public void ReadFieldData(SqlBytesReader reader) { char[] value = reader.ReadChars(this._fieldLength); this._value = new string(value).Trim(); }
public void ReadHeader(SqlBytesReader reader) { char[] array = reader.ReadChars(11); int i; for (i = 0; i < array.Length && array[i] != 0; i++) { } this._fieldName = new string(array, 0, i); this._fieldType = reader.ReadChar(); reader.ReadUInt32(); this._fieldLength = reader.ReadByte(); this._decimalCount = reader.ReadByte(); reader.ReadUInt16(); reader.ReadByte(); reader.ReadUInt16(); reader.ReadByte(); reader.ReadUInt32(); reader.ReadUInt16(); reader.ReadByte(); reader.ReadByte(); if (this._fieldType == 'C') { if (this._fieldLength < 255) { return; } throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, this._fieldType, this._fieldLength)); } if (this._fieldType == 'N') { if (this._fieldLength <= 20) { return; } throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, this._fieldType, this._fieldLength)); } if (this._fieldType == 'L') { if (this._fieldLength == 1) { return; } throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, this._fieldType, this._fieldLength)); } if (this._fieldType == 'D') { if (this._fieldLength == 8) { return; } throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, this._fieldType, this._fieldLength)); } if (this._fieldType == 'F') { if (this._fieldLength <= 20) { return; } throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, this._fieldType, this._fieldLength)); } throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfField, this._fieldType)); }
public void Dispose() { SqlBytesReader reader = this._reader; GC.SuppressFinalize(this); }