private void AssertQuery(int[] expectedItemIds, SodaQueryComparator.Ordering[] orderings
                                 )
        {
            long[] ids = NewQuery(typeof(SodaQueryComparatorTestCase.Item)).Execute().Ext().GetIDs
                             ();
            IList sorted = new SodaQueryComparator(FileSession(), typeof(SodaQueryComparatorTestCase.Item
                                                                         ), orderings).Sort(ids);

            Iterator4Assert.AreEqual(Iterators.Map(expectedItemIds, oidByItemId), Iterators.Iterator
                                         (sorted));
        }
 public void Apply(object container)
 {
     LocalObjectContainer localContainer = (LocalObjectContainer)((IObjectContainer)container
         );
     SodaQueryComparator comparator = new SodaQueryComparator(localContainer, typeof(SodaQueryComparatorBenchmark.Item
         ), new SodaQueryComparator.Ordering[] { new SodaQueryComparator.Ordering(SodaQueryComparator.Direction
         .Ascending, new string[] { "name" }) });
     IQuery query = ((IObjectContainer)container).Query();
     query.Constrain(typeof(SodaQueryComparatorBenchmark.Item));
     IList sortedIds = comparator.Sort(query.Execute().Ext().GetIDs());
     for (IEnumerator idIter = sortedIds.GetEnumerator(); idIter.MoveNext(); )
     {
         int id = ((int)idIter.Current);
         Assert.IsNull(localContainer.GetActivatedObjectFromCache(localContainer.Transaction
             , id));
     }
 }
예제 #3
0
파일: QQueryBase.cs 프로젝트: masroore/db4o
 protected void AddOrdering(SodaQueryComparator.Direction direction, IList path)
 {
     if (i_field != null)
     {
         path.Add(i_field);
     }
     if (i_parent != null)
     {
         i_parent.AddOrdering(direction, path);
         return;
     }
     var fieldPath = ReverseFieldPath(path);
     RemoveExistingOrderingFor(fieldPath);
     Orderings().Add(new SodaQueryComparator.Ordering(direction, fieldPath));
 }
예제 #4
0
파일: QQueryBase.cs 프로젝트: masroore/db4o
 private void AddOrdering(SodaQueryComparator.Direction direction)
 {
     AddOrdering(direction, new ArrayList());
 }