Пример #1
0
        public virtual void TestArray61()
        {
            IOdb odb  = null;
            var  size = 50;

            try
            {
                DeleteBase("array9.ndb");
                odb = Open("array9.ndb");
                var array = new int[size];
                for (var i = 0; i < size; i++)
                {
                    array[i] = i;
                }
                var owna = new ObjectWithNativeArrayOfInt("t1", array);
                odb.Store(owna);
                odb.Close();
                odb = Open("array9.ndb");
                var query = odb.Query <ObjectWithNativeArrayOfInt>();
                var l     = query.Execute <ObjectWithNativeArrayOfInt>();
                var owna2 = l.GetFirst();
                owna2.SetNumber(1, 78);
                odb.Store <ObjectWithNativeArrayOfInt>(owna2);
                odb.Close();
                odb = Open("array9.ndb");
                var query1 = odb.Query <ObjectWithNativeArrayOfInt>();
                l = query1.Execute <ObjectWithNativeArrayOfInt>();
                var o = l.GetFirst();
                AssertEquals((int)0, (int)o.GetNumber(0));
                AssertEquals((int)78, (int)o.GetNumber(1));
            }
            catch (Exception)
            {
                if (odb != null)
                {
                    odb.Rollback();
                    odb = null;
                }
                throw;
            }
            finally
            {
                if (odb != null)
                {
                    odb.Close();
                }
                DeleteBase("array9.ndb");
            }
        }
Пример #2
0
        public virtual void TestArray2()
        {
            IOdb odb  = null;
            var  size = 50;

            try
            {
                DeleteBase("array2.ndb");
                odb = Open("array2.ndb");
                var intArray = new int[size];
                for (var i = 0; i < size; i++)
                {
                    intArray[i] = i;
                }
                var owna = new ObjectWithNativeArrayOfInt("t1", intArray);
                odb.Store(owna);
                odb.Close();
                odb = Open("array2.ndb");
                var query = odb.Query <ObjectWithNativeArrayOfInt>();
                var l     = query.Execute <ObjectWithNativeArrayOfInt>();
                var owna2 = l.GetFirst();
                AssertEquals(owna.GetName(), (string)owna2.GetName());
                for (var i = 0; i < size; i++)
                {
                    AssertEquals(owna.GetNumbers()[i], (int)owna2.GetNumbers()[i]);
                }
                odb.Close();
                odb = null;
            }
            catch (Exception)
            {
                if (odb != null)
                {
                    odb.Rollback();
                    odb = null;
                }
                throw;
            }
            finally
            {
                if (odb != null)
                {
                    odb.Close();
                }
                DeleteBase("array2.ndb");
            }
        }
Пример #3
0
 public virtual void TestArray2()
 {
     IOdb odb = null;
     var size = 50;
     try
     {
         DeleteBase("array2.ndb");
         odb = Open("array2.ndb");
         var intArray = new int[size];
         for (var i = 0; i < size; i++)
             intArray[i] = i;
         var owna = new ObjectWithNativeArrayOfInt("t1", intArray);
         odb.Store(owna);
         odb.Close();
         odb = Open("array2.ndb");
         var query = odb.Query<ObjectWithNativeArrayOfInt>();
         var l = query.Execute<ObjectWithNativeArrayOfInt>();
         var owna2 = l.GetFirst();
         AssertEquals(owna.GetName(), (string) owna2.GetName());
         for (var i = 0; i < size; i++)
             AssertEquals(owna.GetNumbers()[i], (int) owna2.GetNumbers()[i]);
         odb.Close();
         odb = null;
     }
     catch (Exception)
     {
         if (odb != null)
         {
             odb.Rollback();
             odb = null;
         }
         throw;
     }
     finally
     {
         if (odb != null)
             odb.Close();
         DeleteBase("array2.ndb");
     }
 }
Пример #4
0
 public virtual void TestArray61()
 {
     IOdb odb = null;
     var size = 50;
     try
     {
         DeleteBase("array9.ndb");
         odb = Open("array9.ndb");
         var array = new int[size];
         for (var i = 0; i < size; i++)
             array[i] = i;
         var owna = new ObjectWithNativeArrayOfInt("t1", array);
         odb.Store(owna);
         odb.Close();
         odb = Open("array9.ndb");
         var query = odb.Query<ObjectWithNativeArrayOfInt>();
         var l = query.Execute<ObjectWithNativeArrayOfInt>();
         var owna2 = l.GetFirst();
         owna2.SetNumber(1, 78);
         odb.Store<ObjectWithNativeArrayOfInt>(owna2);
         odb.Close();
         odb = Open("array9.ndb");
         var query1 = odb.Query<ObjectWithNativeArrayOfInt>();
         l = query1.Execute<ObjectWithNativeArrayOfInt>();
         var o = l.GetFirst();
         AssertEquals((int) 0, (int) o.GetNumber(0));
         AssertEquals((int) 78, (int) o.GetNumber(1));
     }
     catch (Exception)
     {
         if (odb != null)
         {
             odb.Rollback();
             odb = null;
         }
         throw;
     }
     finally
     {
         if (odb != null)
             odb.Close();
         DeleteBase("array9.ndb");
     }
 }