Пример #1
0
        public CacheRow Find(string identityCode, string searchKey)
        {
            CacheRow cacheRow      = null;
            long     lastRowNumber = 0;

            if (binaryFiles.ContainsKey(identityCode))
            {
                BinaryNavigator navigator = binaryFiles[identityCode].Navigator;
                navigator.MoveToFirst();
                object[] row   = null;
                bool     found = false;
                while (!navigator.EOF())
                {
                    lastRowNumber = navigator.RowNumber;
                    row           = navigator.Read();
                    if (((long)row[0]).ToString() == searchKey)
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    cacheRow = new CacheRow(binaryFiles[identityCode].Header.Columns, lastRowNumber, row);
                }
            }

            return(cacheRow);
        }
Пример #2
0
        public CacheRow[] Select(string identityCode, long rowNumber, long rows = 1)
        {
            List <CacheRow> result    = new List <CacheRow>();
            BinaryNavigator navigator = binaryFiles[identityCode].Navigator;

            if (navigator.Seek(rowNumber))
            {
                for (int index = 0; index < rows; index++)
                {
                    result.Add(new CacheRow(binaryFiles[identityCode].Header.Columns, rowNumber + index, navigator.Read()));
                    if (navigator.EOF())
                    {
                        break;
                    }
                }
            }

            return(result.Count > 0 ? result.ToArray() : null);
        }