public virtual void TestArray61() { NeoDatis.Odb.ODB odb = null; int size = 50; try { NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.ResetNbUpdates(); DeleteBase("array1.neodatis"); odb = Open("array1.neodatis"); int[] array = new int[size]; for (int i = 0; i < size; i++) { array[i] = i; } ObjectWithNativeArrayOfInt owna = new ObjectWithNativeArrayOfInt ("t1", array); odb.Store(owna); odb.Close(); odb = Open("array1.neodatis"); NeoDatis.Odb.Objects <ObjectWithNativeArrayOfInt> l = odb.GetObjects <ObjectWithNativeArrayOfInt>(); ObjectWithNativeArrayOfInt owna2 = (ObjectWithNativeArrayOfInt )l.GetFirst(); owna2.SetNumber(1, 78); odb.Store(owna2); odb.Close(); odb = Open("array1.neodatis"); l = odb.GetObjects <ObjectWithNativeArrayOfInt>(); ObjectWithNativeArrayOfInt o = l.GetFirst(); AssertEquals(0, o.GetNumber(0)); AssertEquals(78, o.GetNumber(1)); } catch (System.Exception e) { if (odb != null) { odb.Rollback(); odb = null; } throw; } finally { if (odb != null) { odb.Close(); } DeleteBase("array1.neodatis"); } }
public virtual void TestArray2() { NeoDatis.Odb.ODB odb = null; int size = 50; try { DeleteBase("array1.neodatis"); odb = Open("array1.neodatis"); int[] intArray = new int[size]; for (int i = 0; i < size; i++) { intArray[i] = i; } ObjectWithNativeArrayOfInt owna = new ObjectWithNativeArrayOfInt ("t1", intArray); odb.Store(owna); odb.Close(); odb = Open("array1.neodatis"); NeoDatis.Odb.Objects <ObjectWithNativeArrayOfInt> l = odb.GetObjects <ObjectWithNativeArrayOfInt>(); ObjectWithNativeArrayOfInt owna2 = l.GetFirst(); AssertEquals(owna.GetName(), owna2.GetName()); for (int i = 0; i < size; i++) { AssertEquals(owna.GetNumbers()[i], owna2.GetNumbers()[i]); } odb.Close(); odb = null; } catch (System.Exception e) { if (odb != null) { odb.Rollback(); odb = null; } throw; } finally { if (odb != null) { odb.Close(); } DeleteBase("array1.neodatis"); } }
/// <exception cref="System.Exception"></exception> public virtual void TestArray2() { NeoDatis.Odb.ODB odb = null; int size = 50; try { DeleteBase("array1.neodatis"); odb = Open("array1.neodatis"); int[] intArray = new int[size]; for (int i = 0; i < size; i++) { intArray[i] = i; } ObjectWithNativeArrayOfInt owna = new ObjectWithNativeArrayOfInt ("t1", intArray); odb.Store(owna); odb.Close(); odb = Open("array1.neodatis"); NeoDatis.Odb.Objects<ObjectWithNativeArrayOfInt> l = odb.GetObjects<ObjectWithNativeArrayOfInt>(); ObjectWithNativeArrayOfInt owna2 = l.GetFirst(); AssertEquals(owna.GetName(), owna2.GetName()); for (int i = 0; i < size; i++) { AssertEquals(owna.GetNumbers()[i], owna2.GetNumbers()[i]); } odb.Close(); odb = null; } catch (System.Exception e) { if (odb != null) { odb.Rollback(); odb = null; } throw; } finally { if (odb != null) { odb.Close(); } DeleteBase("array1.neodatis"); } }
/// <summary> /// Test in place update for array when the number of elements remains the /// same,but updating the second array element /// </summary> /// <exception cref="System.Exception">System.Exception</exception> public virtual void TestArray61() { NeoDatis.Odb.ODB odb = null; int size = 50; try { NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.ResetNbUpdates(); DeleteBase("array1.neodatis"); odb = Open("array1.neodatis"); int[] array = new int[size]; for (int i = 0; i < size; i++) { array[i] = i; } ObjectWithNativeArrayOfInt owna = new ObjectWithNativeArrayOfInt ("t1", array); odb.Store(owna); odb.Close(); odb = Open("array1.neodatis"); NeoDatis.Odb.Objects<ObjectWithNativeArrayOfInt> l = odb.GetObjects<ObjectWithNativeArrayOfInt>(); ObjectWithNativeArrayOfInt owna2 = (ObjectWithNativeArrayOfInt )l.GetFirst(); owna2.SetNumber(1, 78); odb.Store(owna2); odb.Close(); odb = Open("array1.neodatis"); l = odb.GetObjects<ObjectWithNativeArrayOfInt>(); ObjectWithNativeArrayOfInt o = l.GetFirst(); AssertEquals(0, o.GetNumber(0)); AssertEquals(78, o.GetNumber(1)); } catch (System.Exception e) { if (odb != null) { odb.Rollback(); odb = null; } throw; } finally { if (odb != null) { odb.Close(); } DeleteBase("array1.neodatis"); } }