public void CanReadWrittenByteRecord() { var tableFile = RandomFilename; var schema = new Schema(); schema.AddByteField("field"); _tableInfo = new TableInfo(tableFile, schema); _recordFile = new RecordFile(_tableInfo, _transaction); _recordFile.MoveToRID(new RID(0, 0)); _recordFile.SetByte("field", 10); _recordFile.Close(); _transaction.Commit(); var cm = new ConcurrencyManager(); var newTr = new Transaction(_dispatcher, _bufferManager, cm, _fileManager, _logManager); var rf = new RecordFile(_tableInfo, newTr); rf.MoveToRID(new RID(0, 0)); var value = rf.GetByte("field"); Assert.AreEqual(10, value); }
public Constant GetValue(string fieldName) { var type = _schema.FieldType(fieldName); switch (type) { case FieldType.Bool: return(new Constant <bool>(_recordFile.GetBool(fieldName))); case FieldType.Byte: return(new Constant <byte>(_recordFile.GetByte(fieldName))); case FieldType.Integer: return(new Constant <int>(_recordFile.GetInt(fieldName))); case FieldType.Blob: return(new Constant <byte[]>(_recordFile.GetBlob(fieldName))); case FieldType.Date: return(new Constant <DateTime>(_recordFile.GetDate(fieldName))); } return(null); }