Beispiel #1
0
        // =============== Частные случаи =================

        public PValue GetById(string id)
        {
            if (table.Count() == 0)
            {
                return(new PValue(null, Int64.MinValue, null));
            }
            PaEntry entry       = table.Element(0);
            PaEntry index_entry = index_cell.Root.BinarySearchFirst(ent =>
            {
                long off     = (long)ent.Get();
                entry.offset = off;
                return(0 - id.CompareTo((string)entry.Field(i_field).Get()));
            });

            if (index_entry.offset == Int64.MinValue)
            {
                return(new PValue(null, Int64.MinValue, null));
            }
            long cell_offset = (long)index_entry.Get();

            entry.offset = cell_offset;
            var rec = entry.GetValue();

            return(rec);
        }
Beispiel #2
0
        //========================================================= для тестирования, не для использования
        public PValue GetById(string id)
        {
            PaEntry ent = item_dic == null?id_index.GetFirst(en => ((IComparable)en.Field(1).Get()).CompareTo(id))
                              : item_dic[id];

            return(ent.GetValue());
        }
Beispiel #3
0
        public PValue GetById(string id)
        {
            long    offset = si.FindFirst(id);
            PaEntry entry  = cell.Root.Element(0);

            entry.offset = offset;
            var rec = entry.GetValue();

            //Console.WriteLine(rec.Type.Interpret(rec.Value));
            return(rec);
        }
Beispiel #4
0
        public void SelectById(string id)
        {
            long offset = index.SelectFirst(id);
            //Console.WriteLine("offset=" + offset);
            PaEntry entry = cell.Root.Element(0);

            entry.offset = offset;

            PValue pv = entry.GetValue();

            Console.WriteLine("record=" + pv.Type.Interpret(pv.Value));
        }
Beispiel #5
0
        public void Search(string ss)
        {
            ss = ss.ToLower();
            int n = ss.Length;

            foreach (var off in ni.FindAll(obj => {
                if (((string)obj).StartsWith(ss))
                {
                    return(0);
                }
                return(((string)obj).CompareTo(ss));
            }))
            {
                PaEntry entry = cell.Root.Element(0);
                entry.offset = off;
                var rec = entry.GetValue();

                //Console.WriteLine("VAlu=" + rec.Type.Interpret(rec.Value));
            }
        }
        //========================================================= для тестирования, не для использования
        public PValue GetById(string id)
        {
            PaEntry ent = id_index.GetFirst(id);

            return(ent.GetValue());
        }
 //=========================================================
 public void GetById(string id)
 {
     PaEntry ent = id_index.GetFirst(id);
     var     val = ent.GetValue();
     //Console.WriteLine(val.Type.Interpret(val.Value));
 }