コード例 #1
0
ファイル: TestArray.cs プロジェクト: ekicyou/pasta
        public virtual void TestArrayUpdateDecreasingArraySize()
        {
            NeoDatis.Odb.ODB odb = null;
            int size             = 50;

            try
            {
                DeleteBase("array1.neodatis");
                odb = Open("array1.neodatis");
                System.Decimal[] array  = new System.Decimal[size];
                System.Decimal[] array2 = new System.Decimal[size + 1];
                for (int i = 0; i < size; i++)
                {
                    array[i]  = new System.Decimal(((double)i) * 78954545 / 89);
                    array2[i] = new System.Decimal(((double)i) * 78954545 / 89);
                }
                array[size - 1] = new System.Decimal(99);
                array2[size]    = new System.Decimal(100);
                ObjectWithNativeArrayOfBigDecimal owna = new
                                                         ObjectWithNativeArrayOfBigDecimal("t1", array2
                                                                                           );
                odb.Store(owna);
                odb.Close();
                odb = Open("array1.neodatis");
                NeoDatis.Odb.Objects <ObjectWithNativeArrayOfBigDecimal> l = odb.GetObjects <ObjectWithNativeArrayOfBigDecimal>();
                ObjectWithNativeArrayOfBigDecimal owna2 = l.GetFirst();
                owna2.SetNumbers(array);
                odb.Store(owna2);
                odb.Close();
                odb = Open("array1.neodatis");
                l   = odb.GetObjects <ObjectWithNativeArrayOfBigDecimal>();
                ObjectWithNativeArrayOfBigDecimal o = (ObjectWithNativeArrayOfBigDecimal
                                                       )l.GetFirst();
                AssertEquals(size, o.GetNumbers().Length);
                AssertEquals(new System.Decimal(99), o.GetNumber(size - 1));
                AssertEquals(owna2.GetNumber(1), o.GetNumber(1));
                odb = null;
            }
            catch (System.Exception e)
            {
                if (odb != null)
                {
                    odb.Rollback();
                    odb = null;
                }
                throw;
            }
            finally
            {
                if (odb != null)
                {
                    odb.Close();
                }
                DeleteBase("array1.neodatis");
            }
        }
コード例 #2
0
ファイル: TestArray.cs プロジェクト: ekicyou/pasta
        public virtual void TestArray4()
        {
            NeoDatis.Odb.ODB odb = null;
            int size             = 50;

            try
            {
                odb = Open("array1.neodatis");
                System.Decimal[] array = new System.Decimal[size];
                for (int i = 0; i < size; i++)
                {
                    array[i] = new System.Decimal(((double)i) * 78954545 / 89);
                }
                ObjectWithNativeArrayOfBigDecimal owna = new
                                                         ObjectWithNativeArrayOfBigDecimal("t1", array
                                                                                           );
                odb.Store(owna);
                odb.Close();
                odb = Open("array1.neodatis");
                NeoDatis.Odb.Objects <ObjectWithNativeArrayOfBigDecimal> l = odb.GetObjects <ObjectWithNativeArrayOfBigDecimal>();
                ObjectWithNativeArrayOfBigDecimal 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");
            }
        }
コード例 #3
0
ファイル: TestArray.cs プロジェクト: ekicyou/pasta
		/// <exception cref="System.Exception"></exception>
		public virtual void TestArray4()
		{
			NeoDatis.Odb.ODB odb = null;
			int size = 50;
			try
			{
				odb = Open("array1.neodatis");
				System.Decimal[] array = new System.Decimal[size];
				for (int i = 0; i < size; i++)
				{
					array[i] = new System.Decimal(((double)i) * 78954545 / 89);
				}
				ObjectWithNativeArrayOfBigDecimal owna = new 
					ObjectWithNativeArrayOfBigDecimal("t1", array
					);
				odb.Store(owna);
				odb.Close();
				odb = Open("array1.neodatis");
				NeoDatis.Odb.Objects<ObjectWithNativeArrayOfBigDecimal> l = odb.GetObjects<ObjectWithNativeArrayOfBigDecimal>();
				ObjectWithNativeArrayOfBigDecimal 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");
			}
		}