예제 #1
0
        public virtual void Test4()
        {
            DeleteBase("sublist4");
            NeoDatis.Odb.ODB odb = Open("sublist4");
            int i = 0;

            System.Collections.IList functions1 = new System.Collections.ArrayList();
            for (i = 0; i < 30; i++)
            {
                functions1.Add(new NeoDatis.Odb.Test.VO.Login.Function("f1-" + i));
            }
            System.Collections.IList functions2 = new System.Collections.ArrayList();
            for (i = 0; i < 60; i++)
            {
                functions2.Add(new NeoDatis.Odb.Test.VO.Login.Function("f2-" + i));
            }
            System.Collections.IList functions3 = new System.Collections.ArrayList();
            for (i = 0; i < 90; i++)
            {
                functions3.Add(new NeoDatis.Odb.Test.VO.Login.Function("f3-" + i));
            }
            NeoDatis.Odb.Test.VO.Login.User user1 = new NeoDatis.Odb.Test.VO.Login.User("User1"
                                                                                        , "*****@*****.**", new NeoDatis.Odb.Test.VO.Login.Profile("profile1", functions1
                                                                                                                                                      ));
            NeoDatis.Odb.Test.VO.Login.User user2 = new NeoDatis.Odb.Test.VO.Login.User("User2"
                                                                                        , "*****@*****.**", new NeoDatis.Odb.Test.VO.Login.Profile("profile2", functions2
                                                                                                                                                      ));
            NeoDatis.Odb.Test.VO.Login.User user3 = new NeoDatis.Odb.Test.VO.Login.User("User3"
                                                                                        , "*****@*****.**", new NeoDatis.Odb.Test.VO.Login.Profile("profile3", functions3
                                                                                                                                                      ));
            odb.Store(user1);
            odb.Store(user2);
            odb.Store(user3);
            odb.Close();
            odb = Open("sublist4");
            NeoDatis.Odb.Test.VO.Login.User u = (NeoDatis.Odb.Test.VO.Login.User)odb.GetObjects
                                                    (typeof(NeoDatis.Odb.Test.VO.Login.User)).GetFirst();
            System.Console.Out.WriteLine(u);
            NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                         (typeof(NeoDatis.Odb.Test.VO.Login.Profile)).Field("name").Sublist("functions",
                                                                                                                            1, 2, false).Size("functions", "fsize");
            NeoDatis.Odb.Values v = odb.GetValues(q);
            i = 0;
            while (v.HasNext())
            {
                NeoDatis.Odb.ObjectValues ov = v.NextValues();
                string profileName           = (string)ov.GetByAlias("name");
                Println(profileName);
                AssertEquals("profile" + (i + 1), profileName);
                AssertEquals(System.Convert.ToInt64(30 * (i + 1)), ov.GetByAlias("fsize"));
                System.Collections.IList l = (System.Collections.IList)ov.GetByAlias("functions");
                Println(l);
                AssertEquals(2, l.Count);
                i++;
            }
            odb.Close();
        }
예제 #2
0
 private void Merge(NeoDatis.Tool.Wrappers.OdbComparable key, NeoDatis.Odb.Values
                    values)
 {
     while (values.HasNext())
     {
         if (queryHasOrderBy)
         {
             result.AddWithKey(key, values.NextValues());
         }
         else
         {
             result.Add(values.NextValues());
         }
     }
 }