/// <exception cref="System.Exception"></exception> public virtual void Populate() { NeoDatis.Odb.ODB odb = Open("perfOValuesVsCriteria"); int nbProfiles = 200; int nbUsers = 500000; NeoDatis.Odb.Test.VO.Login.Profile[] profiles = new NeoDatis.Odb.Test.VO.Login.Profile [nbProfiles]; NeoDatis.Odb.Test.VO.Login.User2[] users = new NeoDatis.Odb.Test.VO.Login.User2[nbUsers ]; // First creates profiles for (int i = 0; i < nbProfiles; i++) { profiles[i] = new NeoDatis.Odb.Test.VO.Login.Profile("profile " + i, new NeoDatis.Odb.Test.VO.Login.Function ("function Profile" + i)); odb.Store(profiles[i]); } // Then creates users for (int i = 0; i < nbUsers; i++) { users[i] = new NeoDatis.Odb.Test.VO.Login.User2("user" + i, "user mail" + i, profiles [GetProfileIndex(nbProfiles)], i); odb.Store(users[i]); if (i % 10000 == 0) { Println(i); } } odb.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void Populate() { NeoDatis.Odb.ODB odb = Open("perfOValuesVsCriteria"); int nbProfiles = 200; int nbUsers = 500000; NeoDatis.Odb.Test.VO.Login.Profile[] profiles = new NeoDatis.Odb.Test.VO.Login.Profile [nbProfiles]; NeoDatis.Odb.Test.VO.Login.User2[] users = new NeoDatis.Odb.Test.VO.Login.User2[nbUsers ]; // First creates profiles for (int i = 0; i < nbProfiles; i++) { profiles[i] = new NeoDatis.Odb.Test.VO.Login.Profile("profile " + i, new NeoDatis.Odb.Test.VO.Login.Function ("function Profile" + i)); odb.Store(profiles[i]); } // Then creates users for (int i = 0; i < nbUsers; i++) { users[i] = new NeoDatis.Odb.Test.VO.Login.User2("user" + i, "user mail" + i, profiles [GetProfileIndex(nbProfiles)], i); odb.Store(users[i]); if (i % 10000 == 0) { Println(i); } } odb.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void Populate() { NeoDatis.Odb.ODB odb = Open("perfOValuesVsCriteriaIndex"); string[] atts = new string[] { "name" }; try { odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Login.User2)).AddUniqueIndexOn ("Index", atts, true); } catch (System.Exception) { } // TODO: handle exception int nbProfiles = 200; int nbUsers = 500000; NeoDatis.Odb.Test.VO.Login.Profile[] profiles = new NeoDatis.Odb.Test.VO.Login.Profile [nbProfiles]; NeoDatis.Odb.Test.VO.Login.User2[] users = new NeoDatis.Odb.Test.VO.Login.User2[nbUsers ]; int userStart = 1500000; int profileStart = 600; // First creates profiles for (int i = 0; i < nbProfiles; i++) { profiles[i] = new NeoDatis.Odb.Test.VO.Login.Profile("profile " + (i + profileStart ), new NeoDatis.Odb.Test.VO.Login.Function("function Profile" + i)); odb.Store(profiles[i]); } // Then creates users for (int i = 0; i < nbUsers; i++) { users[i] = new NeoDatis.Odb.Test.VO.Login.User2("user" + (i + userStart), "user mail" + i, profiles[GetProfileIndex(nbProfiles)], i); odb.Store(users[i]); if (i % 10000 == 0) { Println(i); } } odb.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void Populate() { NeoDatis.Odb.ODB odb = Open("perfOValuesVsCriteriaIndex"); string[] atts = new string[] { "name" }; try { odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Login.User2)).AddUniqueIndexOn ("Index", atts, true); } catch (System.Exception) { } // TODO: handle exception int nbProfiles = 200; int nbUsers = 500000; NeoDatis.Odb.Test.VO.Login.Profile[] profiles = new NeoDatis.Odb.Test.VO.Login.Profile [nbProfiles]; NeoDatis.Odb.Test.VO.Login.User2[] users = new NeoDatis.Odb.Test.VO.Login.User2[nbUsers ]; int userStart = 1500000; int profileStart = 600; // First creates profiles for (int i = 0; i < nbProfiles; i++) { profiles[i] = new NeoDatis.Odb.Test.VO.Login.Profile("profile " + (i + profileStart ), new NeoDatis.Odb.Test.VO.Login.Function("function Profile" + i)); odb.Store(profiles[i]); } // Then creates users for (int i = 0; i < nbUsers; i++) { users[i] = new NeoDatis.Odb.Test.VO.Login.User2("user" + (i + userStart), "user mail" + i, profiles[GetProfileIndex(nbProfiles)], i); odb.Store(users[i]); if (i % 10000 == 0) { Println(i); } } odb.Close(); }
public virtual void Test3() { DeleteBase("values2"); NeoDatis.Odb.ODB odb = Open("values2"); NeoDatis.Odb.Test.VO.Login.Profile p1 = new NeoDatis.Odb.Test.VO.Login.Profile("profile1" , new NeoDatis.Odb.Test.VO.Login.Function("f1")); NeoDatis.Odb.Test.VO.Login.Profile p2 = new NeoDatis.Odb.Test.VO.Login.Profile("profile2" , new NeoDatis.Odb.Test.VO.Login.Function("f2")); NeoDatis.Odb.Test.VO.Login.User u1 = new NeoDatis.Odb.Test.VO.Login.User2("user1" , "*****@*****.**", p1, 1); NeoDatis.Odb.Test.VO.Login.User u2 = new NeoDatis.Odb.Test.VO.Login.User2("user2" , "*****@*****.**", p1, 2); NeoDatis.Odb.Test.VO.Login.User u3 = new NeoDatis.Odb.Test.VO.Login.User2("user3" , "*****@*****.**", p1, 3); NeoDatis.Odb.Test.VO.Login.User u4 = new NeoDatis.Odb.Test.VO.Login.User2("user4" , "*****@*****.**", p2, 4); NeoDatis.Odb.Test.VO.Login.User u5 = new NeoDatis.Odb.Test.VO.Login.User2("user5" , "*****@*****.**", p2, 5); odb.Store(u1); odb.Store(u2); odb.Store(u3); odb.Store(u4); odb.Store(u5); odb.Close(); odb = Open("values2"); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User2)).Field("profile.name").Count("count"). Avg("nbLogins", "avg").GroupBy("profile.name"); q.OrderByAsc("name"); NeoDatis.Odb.Values values = odb.GetValues(q); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); AssertEquals(2, values.Count); AssertEquals("profile1", ov.GetByAlias("profile.name")); AssertEquals(new System.Decimal("3"), ov.GetByAlias("count")); AssertEquals(new System.Decimal("2.00"), ov.GetByAlias("avg")); odb.Close(); AssertEquals(2, values.Count); }
public virtual void Test3() { DeleteBase("values2"); NeoDatis.Odb.ODB odb = Open("values2"); NeoDatis.Odb.Test.VO.Login.Profile p1 = new NeoDatis.Odb.Test.VO.Login.Profile("profile1" , new NeoDatis.Odb.Test.VO.Login.Function("f1")); NeoDatis.Odb.Test.VO.Login.Profile p2 = new NeoDatis.Odb.Test.VO.Login.Profile("profile2" , new NeoDatis.Odb.Test.VO.Login.Function("f2")); NeoDatis.Odb.Test.VO.Login.User u1 = new NeoDatis.Odb.Test.VO.Login.User2("user1" , "*****@*****.**", p1, 1); NeoDatis.Odb.Test.VO.Login.User u2 = new NeoDatis.Odb.Test.VO.Login.User2("user2" , "*****@*****.**", p1, 2); NeoDatis.Odb.Test.VO.Login.User u3 = new NeoDatis.Odb.Test.VO.Login.User2("user3" , "*****@*****.**", p1, 3); NeoDatis.Odb.Test.VO.Login.User u4 = new NeoDatis.Odb.Test.VO.Login.User2("user4" , "*****@*****.**", p2, 4); NeoDatis.Odb.Test.VO.Login.User u5 = new NeoDatis.Odb.Test.VO.Login.User2("user5" , "*****@*****.**", p2, 5); odb.Store(u1); odb.Store(u2); odb.Store(u3); odb.Store(u4); odb.Store(u5); odb.Close(); odb = Open("values2"); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User2)).Field("profile.name").Count("count"). Avg("nbLogins", "avg").GroupBy("profile.name"); q.OrderByAsc("name"); NeoDatis.Odb.Values values = odb.GetValues(q); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); AssertEquals(2, values.Count); AssertEquals("profile1", ov.GetByAlias("profile.name")); AssertEquals(new System.Decimal("3"), ov.GetByAlias("count")); AssertEquals(new System.Decimal("2.00"), ov.GetByAlias("avg")); odb.Close(); AssertEquals(2, values.Count); }