Esempio n. 1
0
        public void GetLimitStringWithOffsetAndLimitAndTableStartingWithSelectKeywordAndDifferentCasing()
        {
            var dialect   = new Oracle8iDialect();
            var sqlString = new SqlString(@"sElEct selectlimi0_.""Id"" as column1_2_,selectlimi0_.""FirstName"" as column2_2_,selectlimi0_.""LastName"" As column3_2_ fRom ""SelectLimit"" selectlimi0_");
            var expected  = new SqlString(@"select column1_2_,column2_2_,column3_2_ from ( select row_.*, rownum rownum_ from ( sElEct selectlimi0_.""Id"" as column1_2_,selectlimi0_.""FirstName"" as column2_2_,selectlimi0_.""LastName"" As column3_2_ fRom ""SelectLimit"" selectlimi0_ ) row_ where rownum <=1) where rownum_ >1");
            var limited   = dialect.GetLimitString(sqlString, new SqlString("1"), new SqlString("1"));

            Assert.AreEqual(limited, expected);
        }
Esempio n. 2
0
        public void GetLimitStringWithTableStartingWithSelectKeyword()
        {
            var dialect   = new Oracle8iDialect();
            var sqlString = new SqlString(@"select selectlimi0_.""Id"" as column1_2_,selectlimi0_.""FirstName"" as column2_2_,selectlimi0_.""LastName"" as column3_2_ from ""SelectLimit"" selectlimi0_");
            var expected  = new SqlString(@"select column1_2_,column2_2_,column3_2_ from ( select selectlimi0_.""Id"" as column1_2_,selectlimi0_.""FirstName"" as column2_2_,selectlimi0_.""LastName"" as column3_2_ from ""SelectLimit"" selectlimi0_ ) where rownum <=1");
            var limited   = dialect.GetLimitString(sqlString, null, new SqlString("1"));

            Assert.AreEqual(limited, expected);
        }
        public void HasSameUnicodeDefaultThanDialect(bool managed)
        {
            var cfg = TestConfigurationHelper.GetDefaultConfiguration();

            cfg.Properties.Remove(Environment.OracleUseNPrefixedTypesForUnicode);
            var driver  = GetDriver(managed, cfg.Properties);
            var dialect = new Oracle8iDialect();

            dialect.Configure(cfg.Properties);

            Assert.That(driver.UseNPrefixedTypesForUnicode, Is.EqualTo(dialect.UseNPrefixedTypesForUnicode),
                        $"Default {nameof(Oracle8iDialect.UseNPrefixedTypesForUnicode)} values mismatch between driver and dialect");
        }
Esempio n. 4
0
        public void CheckUnicodeWithPrefix()
        {
            var dialect = new Oracle8iDialect();

            var cfg = TestConfigurationHelper.GetDefaultConfiguration();

            cfg.SetProperty(Environment.OracleUseNPrefixedTypesForUnicode, "true");
            dialect.Configure(cfg.Properties);

            Assert.That(dialect.UseNPrefixedTypesForUnicode, Is.True,
                        $"Unexpected value for {nameof(Oracle8iDialect)}.{nameof(Oracle8iDialect.UseNPrefixedTypesForUnicode)} after configuration");

            var unicodeStringType = dialect.GetTypeName(NHibernateUtil.String.SqlType);

            Assert.That(unicodeStringType, Does.StartWith("N").IgnoreCase, "Unexpected type name for an Unicode string");
        }
Esempio n. 5
0
        public void CheckUnicode()
        {
            var dialect = new Oracle8iDialect();
            var cfg     = TestConfigurationHelper.GetDefaultConfiguration();

            dialect.Configure(cfg.Properties);
            var useNPrefixedTypesForUnicode = PropertiesHelper.GetBoolean(Environment.OracleUseNPrefixedTypesForUnicode, cfg.Properties, false);

            Assert.That(dialect.UseNPrefixedTypesForUnicode, Is.EqualTo(useNPrefixedTypesForUnicode),
                        $"Unexpected value for {nameof(Oracle8iDialect)}.{nameof(Oracle8iDialect.UseNPrefixedTypesForUnicode)} after configuration");

            var unicodeStringType = dialect.GetTypeName(NHibernateUtil.String.SqlType);

            Assert.That(unicodeStringType, (useNPrefixedTypesForUnicode ? Does.StartWith("N") : Does.Not.StartWith("N")).IgnoreCase,
                        "Unexpected type name for an Unicode string");
        }