Example #1
0
		/// <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);
			}
		}
Example #2
0
        /// <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);
            }
        }
Example #3
0
        public virtual void Test1()
        {
            NeoDatis.Tool.IOUtil.DeleteFile("base1.neodatis");
            NeoDatis.Odb.ODB odb    = NeoDatis.Odb.ODBFactory.Open("base1.neodatis");
            string[]         fields = new string[] { "int1" };
            odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).AddUniqueIndexOn
                ("index1", fields, true);
            long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
            int  size  = 50;

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass testClass = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                         ();
                testClass.SetBigDecimal1(new System.Decimal(i));
                testClass.SetBoolean1(i % 3 == 0);
                testClass.SetChar1((char)(i % 5));
                testClass.SetDate1(new System.DateTime(start + i));
                testClass.SetDouble1(((double)(i % 10)) / size);
                testClass.SetInt1(size - i);
                testClass.SetString1("test class " + i);
                odb.Store(testClass);
            }
            // println(testClass.getDouble1() + " | " + testClass.getString1() +
            // " | " + testClass.getInt1());
            odb.Close();
        }
        public virtual void Test1()
		{
			NeoDatis.Tool.IOUtil.DeleteFile("base1.neodatis");
			NeoDatis.Odb.ODB odb = NeoDatis.Odb.ODBFactory.Open("base1.neodatis");
			string[] fields = new string[] { "int1" };
			odb.GetClassRepresentation(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).AddUniqueIndexOn
				("index1", fields, true);
			long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
			int size = 50;
			for (int i = 0; i < size; i++)
			{
				NeoDatis.Odb.Test.VO.Attribute.TestClass testClass = new NeoDatis.Odb.Test.VO.Attribute.TestClass
					();
				testClass.SetBigDecimal1(new System.Decimal(i));
				testClass.SetBoolean1(i % 3 == 0);
				testClass.SetChar1((char)(i % 5));
				testClass.SetDate1(new System.DateTime(start + i));
				testClass.SetDouble1(((double)(i % 10)) / size);
				testClass.SetInt1(size - i);
				testClass.SetString1("test class " + i);
				odb.Store(testClass);
			}
			// println(testClass.getDouble1() + " | " + testClass.getString1() +
			// " | " + testClass.getInt1());
			odb.Close();
		}
Example #5
0
		private NeoDatis.Odb.Test.VO.Attribute.TestClass GetTestClassInstance()
		{
			NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
				();
			tc.SetBigDecimal1(new System.Decimal(1.123456789));
			tc.SetBoolean1(true);
			tc.SetChar1('d');
			tc.SetDouble1(154.78998989);
			tc.SetInt1(78964);
			tc.SetString1("Ola chico como vc est√° ???");
			tc.SetDate1(new System.DateTime());
			return tc;
		}
Example #6
0
 private NeoDatis.Odb.Test.VO.Attribute.TestClass GetTestClassInstance()
 {
     NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                       ();
     tc.SetBigDecimal1(new System.Decimal(1.123456789));
     tc.SetBoolean1(true);
     tc.SetChar1('d');
     tc.SetDouble1(154.78998989);
     tc.SetInt1(78964);
     tc.SetString1("Ola chico como vc est√° ???");
     tc.SetDate1(new System.DateTime());
     return(tc);
 }