Exemple #1
0
        public bool TryRead(LogLineIndex sourceStartIndex, int count, ILogBuffer destination, int destinationIndex, bool requiresValidityCheck)
        {
            ++_numReads;
            _lastAccessTime = DateTime.UtcNow;

            var pageSourceIndex = sourceStartIndex - _section.Index;
            var range           = new Int32Range(pageSourceIndex, count);

            foreach (var column in _buffer.Columns)
            {
                if (destination.Contains(column))
                {
                    destination.CopyFrom(column, destinationIndex, _buffer, range);
                }
            }

            if (requiresValidityCheck)
            {
                if (_buffer.ContainsAnyDefault(Columns.Index, range))
                {
                    return(false);
                }
            }

            return(true);
        }
            public bool ContainsAny(T value, Int32Range range)
            {
                for (int i = 0; i < range.Count; ++i)
                {
                    // TODO: Boxing/Unboxing is going to kill us here, we need a generic equality comparer here
                    if (Equals(_data[range.Offset + i], value))
                    {
                        return(true);
                    }
                }

                return(false);
            }
        public bool ContainsAny <T>(IColumnDescriptor <T> column, T value, Int32Range range)
        {
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }

            if (!_dataByColumn.TryGetValue(column, out var data))
            {
                throw new ArgumentException(string.Format("No such column: {0}", column));
            }

            return(((ColumnData <T>)data).ContainsAny(value, range));
        }
        public bool ContainsAnyDefault(IColumnDescriptor column, Int32Range range)
        {
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }

            if (!_dataByColumn.TryGetValue(column, out var data))
            {
                throw new ArgumentException(string.Format("No such column: {0}", column));
            }

            return(data.ContainsAnyDefault(range));
        }
 public bool ContainsAnyDefault(Int32Range range)
 {
     return(ContainsAny(_column.DefaultValue, range));
 }