public virtual void Test1() { DeleteBase("values2"); NeoDatis.Odb.ODB odb = Open("values2"); NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc1.SetInt1(45); odb.Store(tc1); NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc2.SetInt1(45); odb.Store(tc2); NeoDatis.Odb.Test.VO.Attribute.TestClass tc3 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc3.SetInt1(46); odb.Store(tc3); odb.Close(); odb = Open("values2"); NeoDatis.Odb.Core.Query.IValuesQuery vq = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Sum("int1", "sum of int1").GroupBy ("int1"); vq.OrderByAsc("int1"); NeoDatis.Odb.Values values = odb.GetValues(vq); AssertEquals(2, values.Count); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); AssertEquals(System.Decimal.ValueOf(90), ov.GetByAlias("sum of int1")); ov = values.NextValues(); AssertEquals(System.Decimal.ValueOf(46), ov.GetByAlias("sum of int1")); odb.Close(); AssertEquals(2, values.Count); }
public virtual void Test1() { string baseName = GetBaseName(); NeoDatis.Odb.ODB odb = null; int size = 10000; try { odb = Open(baseName); odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Login.Function)).AddIndexOn ("index1", new string[] { "name" }, true); for (int i = 0; i < size; i++) { odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("function " + i)); } odb.Close(); odb = Open(baseName); // build a value query to retrieve only the name of the function NeoDatis.Odb.Core.Query.IValuesQuery vq = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.Function), NeoDatis.Odb.Core.Query.Criteria.Where .Equal("name", "function " + (size - 1))).Field("name"); NeoDatis.Odb.Values values = odb.GetValues(vq); AssertEquals(1, values.Count); Println(vq.GetExecutionPlan().GetDetails()); AssertEquals(true, vq.GetExecutionPlan().UseIndex()); } finally { if (odb != null) { odb.Close(); } } }
public virtual void Test1() { string baseName = GetBaseName(); NeoDatis.Odb.ODB odb = null; int size = 10000; try { odb = Open(baseName); odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Login.Function)).AddIndexOn ("index1", new string[] { "name" }, true); for (int i = 0; i < size; i++) { odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("function " + i)); } odb.Close(); odb = Open(baseName); // build a value query to retrieve only the name of the function NeoDatis.Odb.Core.Query.IValuesQuery vq = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.Function), NeoDatis.Odb.Core.Query.Criteria.Where .Equal("name", "function " + (size - 1))).Field("name"); NeoDatis.Odb.Values values = odb.GetValues(vq); AssertEquals(1, values.Count); Println(vq.GetExecutionPlan().GetDetails()); AssertEquals(true, vq.GetExecutionPlan().UseIndex()); } finally { if (odb != null) { odb.Close(); } } }
public virtual void Test1() { DeleteBase("values2"); NeoDatis.Odb.ODB odb = Open("values2"); NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc1.SetInt1(45); odb.Store(tc1); NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc2.SetInt1(45); odb.Store(tc2); NeoDatis.Odb.Test.VO.Attribute.TestClass tc3 = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc3.SetInt1(46); odb.Store(tc3); odb.Close(); odb = Open("values2"); NeoDatis.Odb.Core.Query.IValuesQuery vq = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Sum("int1", "sum of int1").GroupBy ("int1"); vq.OrderByAsc("int1"); NeoDatis.Odb.Values values = odb.GetValues(vq); AssertEquals(2, values.Count); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); AssertEquals(System.Decimal.ValueOf(90), ov.GetByAlias("sum of int1")); ov = values.NextValues(); AssertEquals(System.Decimal.ValueOf(46), ov.GetByAlias("sum of int1")); odb.Close(); AssertEquals(2, values.Count); }
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(); }
public virtual long Count(NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query) { NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (query).Count("count"); q.SetPolymorphic(query.IsPolymorphic()); NeoDatis.Odb.Values values = storageEngine.GetValues(q, -1, -1); System.Decimal count = (System.Decimal)values.NextValues().GetByIndex(0); return(System.Decimal.ToInt64(count)); }
/// <exception cref="System.Exception"></exception> public virtual void T1est1() { NeoDatis.Odb.ODB odb = Open("perfOValuesVsCriteria"); NeoDatis.Odb.OdbConfiguration.MonitorMemory(true); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User2), NeoDatis.Odb.Core.Query.Criteria.Where .Equal("nbLogins", 100)).Field("name"); NeoDatis.Odb.Values v = odb.GetValues(q); Println(v.Count); System.Console.Out.WriteLine(q.GetExecutionPlan().GetDetails()); AssertEquals(2000000, v.Count); odb.Close(); }
public override long Count(NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query ) { if (isClosed) { throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.OdbIsClosed .AddParameter(baseIdentification.GetIdentification())); } NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (query).Count("count"); NeoDatis.Odb.Values values = GetValues(q, -1, -1); long count = (long)values.NextValues().GetByIndex(0); return(count); }
/// <summary>Using Object representation instead of real object</summary> /// <exception cref="System.IO.IOException"></exception> /// <exception cref="System.Exception"></exception> public virtual void Test5() { int sublistSize = 400; if (!isLocal && !useSameVmOptimization) { sublistSize = 40; } string baseName = GetBaseName(); DeleteBase(baseName); NeoDatis.Odb.ODB odb = Open(baseName); NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler (); for (int i = 0; i < sublistSize; i++) { handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value " + i)); } odb.Store(handler); odb.Close(); odb = Open("valuesSubList3"); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 0, 2, true); NeoDatis.Odb.Values values = odb.GetValues(q); long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); Println("time to load sublist of 5 itens for " + sublistSize + " : " + (end - start )); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); System.Collections.IList sublist = (System.Collections.IList)ov.GetByAlias("sub"); AssertEquals(2, sublist.Count); NeoDatis.Odb.Test.Query.Values.Parameter parameter = (NeoDatis.Odb.Test.Query.Values.Parameter )sublist[1]; AssertEquals("value 1", parameter.GetValue()); NeoDatis.Odb.OID oid = odb.GetObjectId(parameter); Println(oid); odb.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void Test4() { DeleteBase("multi"); NeoDatis.Odb.ODB odb = Open("multi"); odb.Store(new NeoDatis.Odb.Test.VO.Human.Animal("dog", "M", "my dog")); odb.Store(new NeoDatis.Odb.Test.VO.Human.Animal("cat", "F", "my cat")); odb.Store(new NeoDatis.Odb.Test.VO.Human.Man("Joe")); odb.Store(new NeoDatis.Odb.Test.VO.Human.Woman("Karine")); odb.Close(); odb = Open("multi"); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Human.Human)).Field("specie"); q.SetPolymorphic(true); NeoDatis.Odb.Values os = odb.GetValues(q); Println(os); odb.Close(); AssertEquals(2, os.Count); DeleteBase("multi"); }
public virtual void Test5() { DeleteBase("multi"); NeoDatis.Odb.ODB odb = Open("multi"); odb.Store(new NeoDatis.Odb.Test.VO.Human.Animal("dog", "M", "my dog")); odb.Store(new NeoDatis.Odb.Test.VO.Human.Animal("cat", "F", "my cat")); odb.Store(new NeoDatis.Odb.Test.VO.Human.Man("Joe")); odb.Store(new NeoDatis.Odb.Test.VO.Human.Woman("Karine")); odb.Close(); odb = Open("multi"); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Human.Man)).Field("specie"); q.SetPolymorphic(true); NeoDatis.Odb.Values os = odb.GetValues(q); Println(os); odb.Close(); AssertEquals(1, os.Count); DeleteBase("multi"); }
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); }
/// <summary>Using Object representation instead of real object</summary> /// <exception cref="System.IO.IOException"></exception> /// <exception cref="System.Exception"></exception> public virtual void Test3() { int sublistSize = 10000; DeleteBase("valuesSubList3"); NeoDatis.Odb.ODB odb = Open("valuesSubList3"); NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler (); for (int i = 0; i < sublistSize; i++) { handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value " + i)); } odb.Store(handler); odb.Close(); odb = Open("valuesSubList3"); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 9990 , 5, true); q.SetReturnInstance(false); NeoDatis.Odb.Values values = odb.GetValues(q); long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); Println("time to load sublist of 5 itens from 40000 : " + (end - start)); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); System.Collections.IList sublist = (System.Collections.IList)ov.GetByAlias("sub"); AssertEquals(5, sublist.Count); NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo )sublist[0]; AssertEquals("value 9990", nnoi.GetValueOf("value")); NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi2 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo )sublist[4]; AssertEquals("value 9994", nnoi2.GetValueOf("value")); 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 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(); }
public virtual void Test5() { int sublistSize = 400; if (!isLocal && !useSameVmOptimization) { sublistSize = 40; } string baseName = GetBaseName(); DeleteBase(baseName); NeoDatis.Odb.ODB odb = Open(baseName); NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler (); for (int i = 0; i < sublistSize; i++) { handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value " + i)); } odb.Store(handler); odb.Close(); odb = Open("valuesSubList3"); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 0, 2, true); NeoDatis.Odb.Values values = odb.GetValues(q); long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); Println("time to load sublist of 5 itens for " + sublistSize + " : " + (end - start )); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); System.Collections.IList sublist = (System.Collections.IList)ov.GetByAlias("sub"); AssertEquals(2, sublist.Count); NeoDatis.Odb.Test.Query.Values.Parameter parameter = (NeoDatis.Odb.Test.Query.Values.Parameter )sublist[1]; AssertEquals("value 1", parameter.GetValue()); NeoDatis.Odb.OID oid = odb.GetObjectId(parameter); Println(oid); odb.Close(); }
public virtual void Test3() { int sublistSize = 10000; DeleteBase("valuesSubList3"); NeoDatis.Odb.ODB odb = Open("valuesSubList3"); NeoDatis.Odb.Test.Query.Values.Handler handler = new NeoDatis.Odb.Test.Query.Values.Handler (); for (int i = 0; i < sublistSize; i++) { handler.AddParameter(new NeoDatis.Odb.Test.Query.Values.Parameter("test " + i, "value " + i)); } odb.Store(handler); odb.Close(); odb = Open("valuesSubList3"); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.Query.Values.Handler)).Sublist("parameters", "sub", 9990 , 5, true); q.SetReturnInstance(false); NeoDatis.Odb.Values values = odb.GetValues(q); long end = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); Println("time to load sublist of 5 itens from 40000 : " + (end - start)); Println(values); NeoDatis.Odb.ObjectValues ov = values.NextValues(); System.Collections.IList sublist = (System.Collections.IList)ov.GetByAlias("sub"); AssertEquals(5, sublist.Count); NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo )sublist[0]; AssertEquals("value 9990", nnoi.GetValueOf("value")); NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi2 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo )sublist[4]; AssertEquals("value 9994", nnoi2.GetValueOf("value")); odb.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void T1est1() { NeoDatis.Odb.ODB odb = Open("perfOValuesVsCriteria"); NeoDatis.Odb.OdbConfiguration.MonitorMemory(true); NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (typeof(NeoDatis.Odb.Test.VO.Login.User2), NeoDatis.Odb.Core.Query.Criteria.Where .Equal("nbLogins", 100)).Field("name"); NeoDatis.Odb.Values v = odb.GetValues(q); Println(v.Count); System.Console.Out.WriteLine(q.GetExecutionPlan().GetDetails()); AssertEquals(2000000, v.Count); odb.Close(); }
public override long Count(NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery query ) { if (isClosed) { throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.OdbIsClosed .AddParameter(baseIdentification.GetIdentification())); } NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery (query).Count("count"); NeoDatis.Odb.Values values = GetValues(q, -1, -1); long count = (long)values.NextValues().GetByIndex(0); return count; }