/// <exception cref="Java.IO.UnsupportedEncodingException"></exception> public virtual void Test1() { NeoDatis.Odb.ODB odb = null; string baseName = GetBaseName(); Java.Util.Locale defaultLocale = Java.Util.Locale.GetDefault(); try { odb = Open(baseName); NeoDatis.Odb.OdbConfiguration.SetLatinDatabaseCharacterEncoding(); Java.Util.Locale brLocale = new Java.Util.Locale("pt", "BR"); Java.Util.Locale.SetDefault(brLocale); NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass (); tc.SetBigDecimal1(new System.Decimal(5.3)); Println(tc.GetBigDecimal1().ToString()); odb.Store(tc); odb.Close(); odb = Open(baseName); NeoDatis.Odb.Objects <NeoDatis.Odb.Test.VO.Attribute.TestClass> objects = odb.GetObjects (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)); AssertEquals(1, objects.Count); AssertEquals(new System.Decimal(5.3), objects.GetFirst().GetBigDecimal1()); } finally { if (odb != null && !odb.IsClosed()) { odb.Close(); } NeoDatis.Odb.OdbConfiguration.SetDatabaseCharacterEncoding(null); Java.Util.Locale.SetDefault(defaultLocale); } }
public virtual void Test2UpdateTriggers() { if (!testNewFeature) { return; } NeoDatis.Odb.ODB odb = null; string baseName = GetBaseName(); DeleteBase(baseName); NeoDatis.Odb.Test.Trigger.MyUpdateTriggerBefore myTrigger = new NeoDatis.Odb.Test.Trigger.MyUpdateTriggerBefore (); try { odb = Open(baseName); NeoDatis.Odb.Test.Trigger.SimpleObject so = new NeoDatis.Odb.Test.Trigger.SimpleObject (5); NeoDatis.Odb.OID oid = odb.Store(so); AssertEquals(5, so.GetId()); odb.Close(); odb = Open(baseName); odb.AddUpdateTrigger(typeof(NeoDatis.Odb.Test.Trigger.SimpleObject), myTrigger); NeoDatis.Odb.Test.Trigger.SimpleObject so2 = (NeoDatis.Odb.Test.Trigger.SimpleObject )odb.GetObjectFromId(oid); AssertEquals(5, so2.GetId()); odb.Store(so2); odb.Close(); AssertEquals(6, so2.GetId()); odb = Open(baseName); so2 = (NeoDatis.Odb.Test.Trigger.SimpleObject)odb.GetObjectFromId(oid); AssertEquals(6, so2.GetId()); } finally { if (odb != null && !odb.IsClosed()) { odb.Close(); } } DeleteBase(baseName); }