diff --git a/src/NHibernate.Config.Templates/HANA.cfg.xml b/src/NHibernate.Config.Templates/HANA.cfg.xml index 1efeab70083..539e2db7688 100644 --- a/src/NHibernate.Config.Templates/HANA.cfg.xml +++ b/src/NHibernate.Config.Templates/HANA.cfg.xml @@ -7,8 +7,11 @@ for your own use before compile tests in VisualStudio. NHibernate.Driver.HanaDriver + - Server=localhost:39015;UserID=nhibernate;Password= + Server=localhost:39015;UserID=nhibernate;Password=; + Enlist=false; NHibernate.Dialect.HanaColumnStoreDialect diff --git a/src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs b/src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs index 9888fe700a2..de94a8f86a8 100644 --- a/src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs +++ b/src/NHibernate.Test/Ado/GenericBatchingBatcherFixture.cs @@ -29,7 +29,7 @@ protected override bool AppliesTo(Dialect.Dialect dialect) return !(dialect is FirebirdDialect) && !(dialect is Oracle8iDialect) && !(dialect is MsSqlCeDialect) && - !(dialect is AbstractHanaDialect); + !(dialect is HanaDialectBase); } [Test] diff --git a/src/NHibernate.Test/Async/Ado/GenericBatchingBatcherFixture.cs b/src/NHibernate.Test/Async/Ado/GenericBatchingBatcherFixture.cs index 995fbaaf3af..f2889d53c44 100644 --- a/src/NHibernate.Test/Async/Ado/GenericBatchingBatcherFixture.cs +++ b/src/NHibernate.Test/Async/Ado/GenericBatchingBatcherFixture.cs @@ -42,7 +42,7 @@ protected override bool AppliesTo(Dialect.Dialect dialect) return !(dialect is FirebirdDialect) && !(dialect is Oracle8iDialect) && !(dialect is MsSqlCeDialect) && - !(dialect is AbstractHanaDialect); + !(dialect is HanaDialectBase); } [Test] diff --git a/src/NHibernate.Test/Async/Criteria/Lambda/FunctionsIntegrationFixture.cs b/src/NHibernate.Test/Async/Criteria/Lambda/FunctionsIntegrationFixture.cs index 6171cad68be..0b1cc1609ab 100644 --- a/src/NHibernate.Test/Async/Criteria/Lambda/FunctionsIntegrationFixture.cs +++ b/src/NHibernate.Test/Async/Criteria/Lambda/FunctionsIntegrationFixture.cs @@ -19,11 +19,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class FunctionsIntegrationFixtureAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly => "NHibernate.Test"; protected override IList Mappings => new[] { "Criteria.Lambda.Mappings.hbm.xml" }; diff --git a/src/NHibernate.Test/Async/Criteria/Lambda/IntegrationFixture.cs b/src/NHibernate.Test/Async/Criteria/Lambda/IntegrationFixture.cs index 443a327f0fa..434563e7856 100644 --- a/src/NHibernate.Test/Async/Criteria/Lambda/IntegrationFixture.cs +++ b/src/NHibernate.Test/Async/Criteria/Lambda/IntegrationFixture.cs @@ -24,11 +24,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class IntegrationFixtureAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } } protected override IList Mappings @@ -269,6 +264,9 @@ public async Task IsTypeAsync() [Test] public async Task OverrideEagerJoinAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + using (ISession s = OpenSession()) using (ITransaction t = s.BeginTransaction()) { diff --git a/src/NHibernate.Test/Async/Criteria/Lambda/ProjectIntegrationFixture.cs b/src/NHibernate.Test/Async/Criteria/Lambda/ProjectIntegrationFixture.cs index 26b19b1432b..dc73994e402 100644 --- a/src/NHibernate.Test/Async/Criteria/Lambda/ProjectIntegrationFixture.cs +++ b/src/NHibernate.Test/Async/Criteria/Lambda/ProjectIntegrationFixture.cs @@ -20,11 +20,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class ProjectIntegrationFixtureAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } diff --git a/src/NHibernate.Test/Async/Criteria/Lambda/SimpleIntegrationFixture.cs b/src/NHibernate.Test/Async/Criteria/Lambda/SimpleIntegrationFixture.cs index 0c49f9c1c1c..79de02dd0ca 100644 --- a/src/NHibernate.Test/Async/Criteria/Lambda/SimpleIntegrationFixture.cs +++ b/src/NHibernate.Test/Async/Criteria/Lambda/SimpleIntegrationFixture.cs @@ -17,11 +17,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class SimpleIntegrationFixtureAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } diff --git a/src/NHibernate.Test/Async/Criteria/Lambda/SubQueryIntegrationFixture.cs b/src/NHibernate.Test/Async/Criteria/Lambda/SubQueryIntegrationFixture.cs index 3e36927db22..598072d78ca 100644 --- a/src/NHibernate.Test/Async/Criteria/Lambda/SubQueryIntegrationFixture.cs +++ b/src/NHibernate.Test/Async/Criteria/Lambda/SubQueryIntegrationFixture.cs @@ -19,11 +19,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class SubQueryIntegrationFixtureAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } diff --git a/src/NHibernate.Test/Async/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs b/src/NHibernate.Test/Async/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs index 9c6e83b3963..e84b530e523 100644 --- a/src/NHibernate.Test/Async/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs +++ b/src/NHibernate.Test/Async/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs @@ -29,7 +29,7 @@ protected override string MappingsAssembly protected override bool AppliesTo(Dialect.Dialect dialect) { - return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect) && !(dialect is Dialect.AbstractHanaDialect); + return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect) && !(dialect is Dialect.HanaDialectBase); } [Test] diff --git a/src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs b/src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs index 13d187fa3c1..4293af51d2a 100644 --- a/src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs +++ b/src/NHibernate.Test/Async/GenericTest/Overall/Fixture.cs @@ -11,6 +11,7 @@ using System; using System.Collections; using System.Collections.Generic; + using NUnit.Framework; namespace NHibernate.Test.GenericTest.Overall @@ -19,11 +20,6 @@ namespace NHibernate.Test.GenericTest.Overall [TestFixture] public class FixtureAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get { return new[] { "GenericTest.Overall.Mappings.hbm.xml" }; } @@ -57,6 +53,9 @@ public async Task CRUDAsync() [Test] public async Task CRUDABAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + var entity = new A { Property = new B { Prop = 2 }, diff --git a/src/NHibernate.Test/Async/Hql/HQLFunctions.cs b/src/NHibernate.Test/Async/Hql/HQLFunctions.cs index 0cb7675ce82..5addeedd44d 100644 --- a/src/NHibernate.Test/Async/Hql/HQLFunctions.cs +++ b/src/NHibernate.Test/Async/Hql/HQLFunctions.cs @@ -947,7 +947,7 @@ public async Task CastAsync() throw; } } - else if (Dialect is AbstractHanaDialect) + else if (Dialect is HanaDialectBase) { string msgToCheck = "not a GROUP BY expression: 'ANIMAL0_.BODYWEIGHT' must be in group by clause"; diff --git a/src/NHibernate.Test/Async/Legacy/FooBarTest.cs b/src/NHibernate.Test/Async/Legacy/FooBarTest.cs index 18f6546237b..d148a732bf6 100644 --- a/src/NHibernate.Test/Async/Legacy/FooBarTest.cs +++ b/src/NHibernate.Test/Async/Legacy/FooBarTest.cs @@ -24,7 +24,6 @@ using NHibernate.Dialect; using NHibernate.DomainModel; using NHibernate.Criterion; -using NHibernate.Id; using NHibernate.Proxy; using NHibernate.Type; using NHibernate.Util; @@ -43,11 +42,6 @@ private static byte[] GetBytes(string str) return Encoding.Unicode.GetBytes(str); } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get diff --git a/src/NHibernate.Test/Async/Legacy/FumTest.cs b/src/NHibernate.Test/Async/Legacy/FumTest.cs index faad72c71ee..a947a8a1229 100644 --- a/src/NHibernate.Test/Async/Legacy/FumTest.cs +++ b/src/NHibernate.Test/Async/Legacy/FumTest.cs @@ -29,11 +29,6 @@ public class FumTestAsync : TestCase { protected static short fumKeyShort = 1; - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get diff --git a/src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs b/src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs index 2167e46746b..4482ecdf91d 100644 --- a/src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs +++ b/src/NHibernate.Test/Async/Legacy/MasterDetailTest.cs @@ -30,11 +30,6 @@ namespace NHibernate.Test.Legacy [TestFixture] public class MasterDetailTestAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get @@ -57,6 +52,9 @@ protected override IList Mappings [Test] public async Task ParentChildrenAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession session = OpenSession(); M parent = new M(); @@ -847,6 +845,9 @@ public async Task MixNativeAssignedAsync() [Test] public async Task CollectionReplaceOnUpdateAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Category c = new Category(); @@ -892,6 +893,9 @@ public async Task CollectionReplaceOnUpdateAsync() [Test] public async Task CollectionReplace2Async() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Category c = new Category(); @@ -931,6 +935,9 @@ public async Task CollectionReplace2Async() [Test] public async Task CollectionReplaceAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Category c = new Category(); @@ -976,6 +983,9 @@ public async Task CollectionReplaceAsync() [Test] public async Task CategoriesAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + Category c = new Category(); c.Name = Category.RootCategory; Category c1 = new Category(); @@ -1017,6 +1027,9 @@ public async Task CategoriesAsync() [Test] public async Task CollectionRefreshAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); Category c = new Category(); IList list = new List(); @@ -1060,6 +1073,9 @@ public async Task CollectionRefreshAsync() [Test] public async Task CachedCollectionRefreshAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); Category c = new Category(); IList list = new List(); @@ -1245,6 +1261,9 @@ public async Task QueuedBagAddsAsync() [Test] public async Task PolymorphicCriteriaAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction txn = s.BeginTransaction(); Category f = new Category(); diff --git a/src/NHibernate.Test/Async/Legacy/MultiTableTest.cs b/src/NHibernate.Test/Async/Legacy/MultiTableTest.cs index a8fb29df901..6eed8f4564f 100644 --- a/src/NHibernate.Test/Async/Legacy/MultiTableTest.cs +++ b/src/NHibernate.Test/Async/Legacy/MultiTableTest.cs @@ -13,7 +13,6 @@ using System.Collections.Generic; using NHibernate.Dialect; using NHibernate.DomainModel; -using NHibernate.Id; using NUnit.Framework; namespace NHibernate.Test.Legacy @@ -149,7 +148,7 @@ public async Task QueriesAsync() ISession s = OpenSession(); long id = 1L; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { id = (long) await (s.SaveAsync(new TrivialClass())); } @@ -185,7 +184,7 @@ public async Task ConstraintsAsync() ITransaction t = s.BeginTransaction(); SubMulti sm = new SubMulti(); sm.Amount = 66.5f; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { await (s.SaveAsync(sm)); } @@ -206,11 +205,6 @@ public async Task ConstraintsAsync() [Test] public async Task MultiTableAsync() { - if (Dialect is AbstractHanaDialect) - { - Assert.Ignore("feature not supported: Currently specify table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause"); - } - ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); @@ -221,7 +215,7 @@ public async Task MultiTableAsync() simp.Name = "simp"; object mid; object sid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { mid = await (s.SaveAsync(multi)); sid = await (s.SaveAsync(simp)); @@ -236,7 +230,7 @@ public async Task MultiTableAsync() SubMulti sm = new SubMulti(); sm.Amount = 66.5f; object smid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { smid = await (s.SaveAsync(sm)); } @@ -346,11 +340,6 @@ public async Task MultiTableAsync() [Test] public async Task MultiTableGeneratedIdAsync() { - if (Dialect is AbstractHanaDialect) - { - Assert.Ignore("feature not supported: Currently specify table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause"); - } - ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); @@ -475,7 +464,7 @@ public async Task MultiTableCollectionsAsync() simp.Name = "simp"; object mid; object sid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { mid = await (s.SaveAsync(multi)); sid = await (s.SaveAsync(simp)); @@ -495,7 +484,7 @@ public async Task MultiTableCollectionsAsync() ls.Set = new HashSet { multi, simp }; object id; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { id = await (s.SaveAsync(ls)); } @@ -552,7 +541,7 @@ public async Task MultiTableManyToOneAsync() simp.Name = "simp"; object mid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { mid = await (s.SaveAsync(multi)); } @@ -567,7 +556,7 @@ public async Task MultiTableManyToOneAsync() ls.YetAnother = ls; ls.Name = "Less Simple"; object id; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { id = await (s.SaveAsync(ls)); } @@ -614,9 +603,7 @@ public async Task MultiTableNativeIdAsync() public async Task CollectionAsync() { if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) - { - Assert.Ignore("Empty inserts are not supported by the current dialect."); - } + Assert.Ignore("Support of empty inserts is required"); ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); diff --git a/src/NHibernate.Test/Async/Legacy/ParentChildTest.cs b/src/NHibernate.Test/Async/Legacy/ParentChildTest.cs index 4d6fb4c0ad6..5a6f6b6fd10 100644 --- a/src/NHibernate.Test/Async/Legacy/ParentChildTest.cs +++ b/src/NHibernate.Test/Async/Legacy/ParentChildTest.cs @@ -24,11 +24,6 @@ namespace NHibernate.Test.Legacy [TestFixture] public class ParentChildTestAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get @@ -60,6 +55,9 @@ protected override IList Mappings [Test] public async Task ReplicateAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); Container baz = new Container(); Contained f = new Contained(); @@ -358,6 +356,9 @@ public async Task ClassWhereAsync() [Test] public async Task CollectionQueryAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); @@ -515,6 +516,9 @@ public async Task ParentNullChildAsync() [Test] public async Task ManyToManyAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + // if( dialect is Dialect.HSQLDialect) return; ISession s = OpenSession(); @@ -572,6 +576,9 @@ public async Task ManyToManyAsync() [Test] public async Task ContainerAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); @@ -704,6 +711,9 @@ public async Task ContainerAsync() [Test] public async Task CascadeCompositeElementsAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + Container c = new Container(); c.Cascades = new List(); @@ -765,6 +775,9 @@ public async Task CascadeCompositeElementsAsync() [Test] public async Task BagAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + //if( dialect is Dialect.HSQLDialect ) return; ISession s = OpenSession(); diff --git a/src/NHibernate.Test/Async/NHSpecificTest/ListsWithHoles/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/ListsWithHoles/Fixture.cs index ac92e45e482..160622f9b90 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/ListsWithHoles/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/ListsWithHoles/Fixture.cs @@ -18,12 +18,12 @@ namespace NHibernate.Test.NHSpecificTest.ListsWithHoles [TestFixture] public class FixtureAsync : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + } - protected override IList Mappings + protected override IList Mappings { get { return new string[] { "NHSpecificTest.ListsWithHoles.Mappings.hbm.xml" }; } } diff --git a/src/NHibernate.Test/Async/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs index 1c93aebbe0e..58e5c02b4b0 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs @@ -32,9 +32,9 @@ protected override string MappingsAssembly get { return "NHibernate.Test"; } } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; } protected override DebugSessionFactory BuildSessionFactory() diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH1192/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH1192/Fixture.cs index 63f37734afa..84a4c2c6398 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH1192/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH1192/Fixture.cs @@ -19,8 +19,7 @@ public class FixtureAsync : BugTestCase { protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is Oracle8iDialect) && - !(dialect is AbstractHanaDialect); + return !(dialect is Oracle8iDialect); } protected override void OnSetUp() diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture1.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture1.cs index e2c5e78bd47..d249389ec0a 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture1.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture1.cs @@ -17,27 +17,27 @@ namespace NHibernate.Test.NHSpecificTest.NH1601 [TestFixture] public class Fixture1Async : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - - /// - /// Loads the project do not call Count on the list assigned. - /// - [Test] + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + } + + /// + /// Loads the project do not call Count on the list assigned. + /// + [Test] public Task TestSaveAndLoadWithoutCountAsync() - { - try - { - ProjectWithOneList.TestAccessToList = false; - return SaveAndLoadProjectWithOneListAsync(); - } - catch (System.Exception ex) - { - return Task.FromException(ex); - } - } + { + try + { + ProjectWithOneList.TestAccessToList = false; + return SaveAndLoadProjectWithOneListAsync(); + } + catch (System.Exception ex) + { + return Task.FromException(ex); + } + } /// /// Refreshes the project do not call Count on the list assigned. diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture2.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture2.cs index 7137148460b..d5c4d00461b 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture2.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH1601/Fixture2.cs @@ -17,27 +17,27 @@ namespace NHibernate.Test.NHSpecificTest.NH1601 [TestFixture] public class Fixture2Async : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - - /// - /// Loads the project and when Scenario2 and Scenario3 are set calls Count on the list assigned. - /// - [Test] + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + } + + /// + /// Loads the project and when Scenario2 and Scenario3 are set calls Count on the list assigned. + /// + [Test] public Task TestSaveAndLoadWithTwoCountsAsync() - { - try - { - Project.TestAccessToList = false; - return SaveAndLoadProjectAsync(); - } - catch (System.Exception ex) - { - return Task.FromException(ex); - } - } + { + try + { + Project.TestAccessToList = false; + return SaveAndLoadProjectAsync(); + } + catch (System.Exception ex) + { + return Task.FromException(ex); + } + } /// /// Refreshes the project and when Scenario2 and Scenario3 are set calls Count on the list assigned. diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH1609/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH1609/Fixture.cs index 6975d2d08eb..f64a4444dbd 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH1609/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH1609/Fixture.cs @@ -10,6 +10,7 @@ using System.Collections; using NHibernate.Criterion; +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1609 @@ -24,11 +25,6 @@ protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory) return factory.ConnectionProvider.Driver.SupportsMultipleQueries; } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public async Task TestAsync() { diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH1775/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH1775/Fixture.cs index 4af86b32fc8..b0a6bdf6017 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH1775/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH1775/Fixture.cs @@ -20,8 +20,7 @@ public class FixtureAsync : BugTestCase { protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is Oracle8iDialect) && - !(dialect is AbstractHanaDialect); + return !(dialect is Oracle8iDialect); } protected override void OnSetUp() diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH1869/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH1869/Fixture.cs index 65a85dd5188..0137e1fcc94 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH1869/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH1869/Fixture.cs @@ -9,6 +9,7 @@ using System.Collections; +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1869 @@ -25,11 +26,6 @@ protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory) return factory.ConnectionProvider.Driver.SupportsMultipleQueries; } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override void OnTearDown() { using (var session = Sfi.OpenSession()) diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH2705/Test.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH2705/Test.cs index 6ec92361ac0..f81135448a8 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH2705/Test.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH2705/Test.cs @@ -31,11 +31,6 @@ public class TestAsync : BugTestCase .Where(p => p.SubItem.Name == name).ToListAsync(cancellationToken)); } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public void Fetch_OnComponent_ShouldNotThrowAsync() { diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH3050/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH3050/Fixture.cs index 2bcaaeee0e9..c8aedc6450f 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH3050/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH3050/Fixture.cs @@ -16,22 +16,17 @@ using System.Threading.Tasks; using NHibernate.Engine.Query; +using NHibernate.Linq; using NHibernate.Util; using NUnit.Framework; using System.Linq; -using NHibernate.Linq; namespace NHibernate.Test.NHSpecificTest.NH3050 { [TestFixture] public class FixtureAsync : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public async Task TestAsync() { diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH386/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH386/Fixture.cs index 5ac63fcbe84..96f71b7d62d 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH386/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH386/Fixture.cs @@ -8,6 +8,7 @@ //------------------------------------------------------------------------------ +using System; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH386 @@ -21,11 +22,6 @@ public override string BugNumber get { return "NH386"; } } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public async Task QueryAsync() { diff --git a/src/NHibernate.Test/Async/NHSpecificTest/NH623/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/NH623/Fixture.cs index 6f0c2cb13f2..b570712dbdd 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/NH623/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/NH623/Fixture.cs @@ -26,7 +26,7 @@ public override string BugNumber protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is AbstractHanaDialect); // The WHERE clause "isactive = '1'" doesn't work on HANA because idactive is a boolean + return !(dialect is HanaDialectBase); // The WHERE clause "isactive = '1'" doesn't work on HANA because idactive is a boolean } private ISession session; diff --git a/src/NHibernate.Test/Async/NHSpecificTest/Properties/CompositePropertyRefTest.cs b/src/NHibernate.Test/Async/NHSpecificTest/Properties/CompositePropertyRefTest.cs index 953ba87799b..35d73040c17 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/Properties/CompositePropertyRefTest.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/Properties/CompositePropertyRefTest.cs @@ -10,7 +10,6 @@ using System; using System.Linq; -using NHibernate.Dialect; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.Properties @@ -22,11 +21,6 @@ public class CompositePropertyRefTestAsync : BugTestCase private long p_id; private long p2_id; - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return !(dialect is AbstractHanaDialect); // HANA doesn't support foreign key constraints over unique key columns - } - protected override void OnSetUp() { using (var s = OpenSession()) diff --git a/src/NHibernate.Test/Async/NHSpecificTest/Properties/DynamicEntityTest.cs b/src/NHibernate.Test/Async/NHSpecificTest/Properties/DynamicEntityTest.cs index e0032c363dc..90fa8b3a468 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/Properties/DynamicEntityTest.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/Properties/DynamicEntityTest.cs @@ -10,7 +10,6 @@ using System.Collections; using System.Collections.Generic; -using NHibernate.Dialect; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.Properties @@ -19,11 +18,6 @@ namespace NHibernate.Test.NHSpecificTest.Properties [TestFixture] public class DynamicEntityTestAsync : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return !(dialect is AbstractHanaDialect); // HANA doesn't support foreign key constraints over unique key columns - } - protected override void OnSetUp() { using (var s = OpenSession()) diff --git a/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs index a01b630215d..fc8c339848e 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs @@ -35,11 +35,6 @@ protected override bool AppliesTo(ISessionFactoryImplementor factory) return factory.ConnectionProvider.Driver is SqlClientDriver; } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public void NormalHqlShouldThrowUserExceptionAsync() { diff --git a/src/NHibernate.Test/Async/Operations/MergeFixture.cs b/src/NHibernate.Test/Async/Operations/MergeFixture.cs index 493041c82a0..125950bd47d 100644 --- a/src/NHibernate.Test/Async/Operations/MergeFixture.cs +++ b/src/NHibernate.Test/Async/Operations/MergeFixture.cs @@ -22,8 +22,7 @@ public class MergeFixtureAsync : AbstractOperationTestCase { protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is Dialect.FirebirdDialect) && // Firebird has no CommandTimeout, and locks up during the tear-down of this fixture - (TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator); + return !(dialect is Dialect.FirebirdDialect); // Firebird has no CommandTimeout, and locks up during the tear-down of this fixture } protected override void OnTearDown() @@ -400,6 +399,9 @@ public async Task MergeManagedAsync() [Test] public async Task MergeManyToManyWithCollectionDeferenceAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + // setup base data... Competition competition; using (ISession s = OpenSession()) @@ -824,6 +826,9 @@ public async Task PersistThenMergeInSameTxnWithVersionAsync() [Test] public async Task RecursiveMergeTransientAsync() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + using (ISession s = OpenSession()) { using (ITransaction tx = s.BeginTransaction()) diff --git a/src/NHibernate.Test/Async/SystemTransactions/SystemTransactionFixture.cs b/src/NHibernate.Test/Async/SystemTransactions/SystemTransactionFixture.cs index c9dc337df13..fa4b3af96d9 100644 --- a/src/NHibernate.Test/Async/SystemTransactions/SystemTransactionFixture.cs +++ b/src/NHibernate.Test/Async/SystemTransactions/SystemTransactionFixture.cs @@ -190,8 +190,14 @@ public async Task CanUseSessionWithManyScopesAsync(bool explicitFlush) // ODBC with SQL-Server always causes scopes to go distributed, which causes their transaction completion to run // asynchronously. But ODBC enlistment also check the previous transaction in a way that do not guard against it // being concurrently disposed of. See https://github.com/nhibernate/nhibernate-core/pull/1505 for more details. - Assume.That(!(Sfi.ConnectionProvider.Driver is OdbcDriver), - "ODBC sometimes fails on second scope by checking the previous transaction status, which may yield an object disposed exception"); + if (Sfi.ConnectionProvider.Driver is OdbcDriver) + Assert.Ignore("ODBC sometimes fails on second scope by checking the previous transaction status, which may yield an object disposed exception"); + // SAP HANA .Net provider always causes system transactions to be distributed, causing them to complete + // on concurrent threads. This creates race conditions when chaining scopes, the subsequent scope usage + // finding the connection still enlisted in the previous transaction, its complete being still not finished + // on its own thread. + if (Sfi.ConnectionProvider.Driver is HanaDriver) + Assert.Ignore("SAP HANA scope handling causes concurrency issues preventing chaining scope usages."); using (var s = WithOptions().ConnectionReleaseMode(ConnectionReleaseMode.OnClose).OpenSession()) { diff --git a/src/NHibernate.Test/Criteria/Lambda/FunctionsIntegrationFixture.cs b/src/NHibernate.Test/Criteria/Lambda/FunctionsIntegrationFixture.cs index 6834278c7d9..4ae52757192 100644 --- a/src/NHibernate.Test/Criteria/Lambda/FunctionsIntegrationFixture.cs +++ b/src/NHibernate.Test/Criteria/Lambda/FunctionsIntegrationFixture.cs @@ -8,11 +8,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class FunctionsIntegrationFixture : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly => "NHibernate.Test"; protected override IList Mappings => new[] { "Criteria.Lambda.Mappings.hbm.xml" }; diff --git a/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs b/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs index e42198acbb0..6adbb11f0b1 100644 --- a/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs +++ b/src/NHibernate.Test/Criteria/Lambda/IntegrationFixture.cs @@ -12,11 +12,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class IntegrationFixture : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } } protected override IList Mappings @@ -257,6 +252,9 @@ public void IsType() [Test] public void OverrideEagerJoin() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + using (ISession s = OpenSession()) using (ITransaction t = s.BeginTransaction()) { diff --git a/src/NHibernate.Test/Criteria/Lambda/ProjectIntegrationFixture.cs b/src/NHibernate.Test/Criteria/Lambda/ProjectIntegrationFixture.cs index ce7ffd9048e..f6b5d7d9c3a 100644 --- a/src/NHibernate.Test/Criteria/Lambda/ProjectIntegrationFixture.cs +++ b/src/NHibernate.Test/Criteria/Lambda/ProjectIntegrationFixture.cs @@ -9,11 +9,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class ProjectIntegrationFixture : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } diff --git a/src/NHibernate.Test/Criteria/Lambda/SimpleIntegrationFixture.cs b/src/NHibernate.Test/Criteria/Lambda/SimpleIntegrationFixture.cs index a7d39714b0c..1cdd44c982a 100644 --- a/src/NHibernate.Test/Criteria/Lambda/SimpleIntegrationFixture.cs +++ b/src/NHibernate.Test/Criteria/Lambda/SimpleIntegrationFixture.cs @@ -6,11 +6,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class SimpleIntegrationFixture : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } diff --git a/src/NHibernate.Test/Criteria/Lambda/SubQueryIntegrationFixture.cs b/src/NHibernate.Test/Criteria/Lambda/SubQueryIntegrationFixture.cs index e8e1beb9243..55d1a1e5f43 100644 --- a/src/NHibernate.Test/Criteria/Lambda/SubQueryIntegrationFixture.cs +++ b/src/NHibernate.Test/Criteria/Lambda/SubQueryIntegrationFixture.cs @@ -8,11 +8,6 @@ namespace NHibernate.Test.Criteria.Lambda [TestFixture] public class SubQueryIntegrationFixture : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override string MappingsAssembly { get { return "NHibernate.Test"; } diff --git a/src/NHibernate.Test/DialectTest/FunctionTests/SubstringSupportFixture.cs b/src/NHibernate.Test/DialectTest/FunctionTests/SubstringSupportFixture.cs index 38f422d739c..8644493b502 100644 --- a/src/NHibernate.Test/DialectTest/FunctionTests/SubstringSupportFixture.cs +++ b/src/NHibernate.Test/DialectTest/FunctionTests/SubstringSupportFixture.cs @@ -34,20 +34,28 @@ public void DialectShouldUseCorrectSubstringImplementation(System.Type dialectTy var substringFunction = dialect.Functions["substring"]; - if (dialect is MsSql2000Dialect || dialect is MsSqlCeDialect || dialect is SybaseASE15Dialect) - Assert.That(substringFunction, Is.TypeOf()); - else if (dialect is DB2Dialect) - Assert.That(substringFunction, Is.TypeOf()); - else if (dialect is SybaseSQLAnywhere10Dialect) - Assert.That(substringFunction, Is.TypeOf()); - else if (dialect is Oracle8iDialect) - Assert.That(substringFunction, Is.TypeOf()); - else if (dialect is SQLiteDialect) - Assert.That(substringFunction, Is.TypeOf()); - else if (dialect is AbstractHanaDialect) - Assert.That(substringFunction, Is.TypeOf()); - else - Assert.That(substringFunction, Is.TypeOf()); + switch (dialect) + { + case MsSql2000Dialect _: + case MsSqlCeDialect _: + case SybaseASE15Dialect _: + Assert.That(substringFunction, Is.TypeOf()); + break; + case DB2Dialect _: + Assert.That(substringFunction, Is.TypeOf()); + break; + case SybaseSQLAnywhere10Dialect _: + Assert.That(substringFunction, Is.TypeOf()); + break; + case Oracle8iDialect _: + case SQLiteDialect _: + case HanaDialectBase _: + Assert.That(substringFunction, Is.TypeOf()); + break; + default: + Assert.That(substringFunction, Is.TypeOf()); + break; + } } } diff --git a/src/NHibernate.Test/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs b/src/NHibernate.Test/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs index 878681d0ee0..23c0e4128fe 100644 --- a/src/NHibernate.Test/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs +++ b/src/NHibernate.Test/Generatedkeys/Seqidentity/SequenceIdentityFixture.cs @@ -18,7 +18,7 @@ protected override string MappingsAssembly protected override bool AppliesTo(Dialect.Dialect dialect) { - return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect) && !(dialect is Dialect.AbstractHanaDialect); + return dialect.SupportsSequences && !(dialect is Dialect.MsSql2012Dialect) && !(dialect is Dialect.HanaDialectBase); } [Test] diff --git a/src/NHibernate.Test/GenericTest/Overall/Fixture.cs b/src/NHibernate.Test/GenericTest/Overall/Fixture.cs index 9b804951520..95d1f068b4a 100644 --- a/src/NHibernate.Test/GenericTest/Overall/Fixture.cs +++ b/src/NHibernate.Test/GenericTest/Overall/Fixture.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; + using NUnit.Framework; namespace NHibernate.Test.GenericTest.Overall @@ -8,11 +9,6 @@ namespace NHibernate.Test.GenericTest.Overall [TestFixture] public class Fixture : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get { return new[] { "GenericTest.Overall.Mappings.hbm.xml" }; } @@ -46,6 +42,9 @@ public void CRUD() [Test] public void CRUDAB() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + var entity = new A { Property = new B { Prop = 2 }, diff --git a/src/NHibernate.Test/Hql/HQLFunctions.cs b/src/NHibernate.Test/Hql/HQLFunctions.cs index 2c8edcb0d7c..778dde485d9 100644 --- a/src/NHibernate.Test/Hql/HQLFunctions.cs +++ b/src/NHibernate.Test/Hql/HQLFunctions.cs @@ -936,7 +936,7 @@ public void Cast() throw; } } - else if (Dialect is AbstractHanaDialect) + else if (Dialect is HanaDialectBase) { string msgToCheck = "not a GROUP BY expression: 'ANIMAL0_.BODYWEIGHT' must be in group by clause"; diff --git a/src/NHibernate.Test/Legacy/FooBarTest.cs b/src/NHibernate.Test/Legacy/FooBarTest.cs index 80e319046ca..0a05c46e884 100644 --- a/src/NHibernate.Test/Legacy/FooBarTest.cs +++ b/src/NHibernate.Test/Legacy/FooBarTest.cs @@ -14,7 +14,6 @@ using NHibernate.Dialect; using NHibernate.DomainModel; using NHibernate.Criterion; -using NHibernate.Id; using NHibernate.Proxy; using NHibernate.Type; using NHibernate.Util; @@ -31,11 +30,6 @@ private static byte[] GetBytes(string str) return Encoding.Unicode.GetBytes(str); } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get diff --git a/src/NHibernate.Test/Legacy/FumTest.cs b/src/NHibernate.Test/Legacy/FumTest.cs index c25d00fd12c..d1373873159 100644 --- a/src/NHibernate.Test/Legacy/FumTest.cs +++ b/src/NHibernate.Test/Legacy/FumTest.cs @@ -18,11 +18,6 @@ public class FumTest : TestCase { protected static short fumKeyShort = 1; - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get diff --git a/src/NHibernate.Test/Legacy/MasterDetailTest.cs b/src/NHibernate.Test/Legacy/MasterDetailTest.cs index fde99165dcb..5b6fb4eba27 100644 --- a/src/NHibernate.Test/Legacy/MasterDetailTest.cs +++ b/src/NHibernate.Test/Legacy/MasterDetailTest.cs @@ -19,11 +19,6 @@ namespace NHibernate.Test.Legacy [TestFixture] public class MasterDetailTest : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get @@ -46,6 +41,9 @@ protected override IList Mappings [Test] public void ParentChildren() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession session = OpenSession(); M parent = new M(); @@ -846,6 +844,9 @@ public void MixNativeAssigned() [Test] public void CollectionReplaceOnUpdate() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Category c = new Category(); @@ -891,6 +892,9 @@ public void CollectionReplaceOnUpdate() [Test] public void CollectionReplace2() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Category c = new Category(); @@ -930,6 +934,9 @@ public void CollectionReplace2() [Test] public void CollectionReplace() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Category c = new Category(); @@ -975,6 +982,9 @@ public void CollectionReplace() [Test] public void Categories() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + Category c = new Category(); c.Name = Category.RootCategory; Category c1 = new Category(); @@ -1016,6 +1026,9 @@ public void Categories() [Test] public void CollectionRefresh() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); Category c = new Category(); IList list = new List(); @@ -1059,6 +1072,9 @@ public void CollectionRefresh() [Test] public void CachedCollectionRefresh() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); Category c = new Category(); IList list = new List(); @@ -1244,6 +1260,9 @@ public void QueuedBagAdds() [Test] public void PolymorphicCriteria() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction txn = s.BeginTransaction(); Category f = new Category(); diff --git a/src/NHibernate.Test/Legacy/MultiTableTest.cs b/src/NHibernate.Test/Legacy/MultiTableTest.cs index 8c740cb7cce..30ecf60edb7 100644 --- a/src/NHibernate.Test/Legacy/MultiTableTest.cs +++ b/src/NHibernate.Test/Legacy/MultiTableTest.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using NHibernate.Dialect; using NHibernate.DomainModel; -using NHibernate.Id; using NUnit.Framework; namespace NHibernate.Test.Legacy @@ -150,7 +149,7 @@ public void Queries() ISession s = OpenSession(); long id = 1L; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { id = (long) s.Save(new TrivialClass()); } @@ -186,7 +185,7 @@ public void Constraints() ITransaction t = s.BeginTransaction(); SubMulti sm = new SubMulti(); sm.Amount = 66.5f; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { s.Save(sm); } @@ -207,11 +206,6 @@ public void Constraints() [Test] public void MultiTable() { - if (Dialect is AbstractHanaDialect) - { - Assert.Ignore("feature not supported: Currently specify table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause"); - } - ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); @@ -222,7 +216,7 @@ public void MultiTable() simp.Name = "simp"; object mid; object sid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { mid = s.Save(multi); sid = s.Save(simp); @@ -237,7 +231,7 @@ public void MultiTable() SubMulti sm = new SubMulti(); sm.Amount = 66.5f; object smid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { smid = s.Save(sm); } @@ -347,11 +341,6 @@ public void MultiTable() [Test] public void MultiTableGeneratedId() { - if (Dialect is AbstractHanaDialect) - { - Assert.Ignore("feature not supported: Currently specify table name by 'FOR UPDATE of t1.c1' if there are more than one tables/views/subqueries in the FROM clause"); - } - ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi = new Multi(); @@ -476,7 +465,7 @@ public void MultiTableCollections() simp.Name = "simp"; object mid; object sid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { mid = s.Save(multi); sid = s.Save(simp); @@ -496,7 +485,7 @@ public void MultiTableCollections() ls.Set = new HashSet { multi, simp }; object id; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { id = s.Save(ls); } @@ -553,7 +542,7 @@ public void MultiTableManyToOne() simp.Name = "simp"; object mid; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { mid = s.Save(multi); } @@ -568,7 +557,7 @@ public void MultiTableManyToOne() ls.YetAnother = ls; ls.Name = "Less Simple"; object id; - if (Dialect is MsSql2000Dialect || Dialect is AbstractHanaDialect) + if (TestDialect.HasIdentityNativeGenerator) { id = s.Save(ls); } @@ -615,9 +604,7 @@ public void MultiTableNativeId() public void Collection() { if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) - { - Assert.Ignore("Empty inserts are not supported by the current dialect."); - } + Assert.Ignore("Support of empty inserts is required"); ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); diff --git a/src/NHibernate.Test/Legacy/ParentChildTest.cs b/src/NHibernate.Test/Legacy/ParentChildTest.cs index 599b36a6686..2790357ad8a 100644 --- a/src/NHibernate.Test/Legacy/ParentChildTest.cs +++ b/src/NHibernate.Test/Legacy/ParentChildTest.cs @@ -13,11 +13,6 @@ namespace NHibernate.Test.Legacy [TestFixture] public class ParentChildTest : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override IList Mappings { get @@ -49,6 +44,9 @@ protected override IList Mappings [Test] public void Replicate() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); Container baz = new Container(); Contained f = new Contained(); @@ -347,6 +345,9 @@ public void ClassWhere() [Test] public void CollectionQuery() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); @@ -504,6 +505,9 @@ public void ParentNullChild() [Test] public void ManyToMany() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + // if( dialect is Dialect.HSQLDialect) return; ISession s = OpenSession(); @@ -561,6 +565,9 @@ public void ManyToMany() [Test] public void Container() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Container c = new Container(); @@ -693,6 +700,9 @@ public void Container() [Test] public void CascadeCompositeElements() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + Container c = new Container(); c.Cascades = new List(); @@ -754,6 +764,9 @@ public void CascadeCompositeElements() [Test] public void Bag() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + //if( dialect is Dialect.HSQLDialect ) return; ISession s = OpenSession(); diff --git a/src/NHibernate.Test/NHSpecificTest/ListsWithHoles/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/ListsWithHoles/Fixture.cs index d6709f8dadd..1ca671df404 100644 --- a/src/NHibernate.Test/NHSpecificTest/ListsWithHoles/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/ListsWithHoles/Fixture.cs @@ -7,12 +7,12 @@ namespace NHibernate.Test.NHSpecificTest.ListsWithHoles [TestFixture] public class Fixture : TestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + } - protected override IList Mappings + protected override IList Mappings { get { return new string[] { "NHSpecificTest.ListsWithHoles.Mappings.hbm.xml" }; } } diff --git a/src/NHibernate.Test/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs index 3d8d99a27db..3acdfcb0b76 100644 --- a/src/NHibernate.Test/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/LoadingNullEntityInSet/Fixture.cs @@ -21,9 +21,9 @@ protected override string MappingsAssembly get { return "NHibernate.Test"; } } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; } protected override DebugSessionFactory BuildSessionFactory() diff --git a/src/NHibernate.Test/NHSpecificTest/NH1192/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1192/Fixture.cs index 40f8cc5770e..26f65d86db1 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH1192/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH1192/Fixture.cs @@ -8,8 +8,7 @@ public class Fixture : BugTestCase { protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is Oracle8iDialect) && - !(dialect is AbstractHanaDialect); + return !(dialect is Oracle8iDialect); } protected override void OnSetUp() diff --git a/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture1.cs b/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture1.cs index 7da77c773ad..c7077c576d7 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture1.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture1.cs @@ -5,15 +5,15 @@ namespace NHibernate.Test.NHSpecificTest.NH1601 [TestFixture] public class Fixture1 : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - - /// - /// Loads the project do not call Count on the list assigned. - /// - [Test] + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + } + + /// + /// Loads the project do not call Count on the list assigned. + /// + [Test] public void TestSaveAndLoadWithoutCount() { ProjectWithOneList.TestAccessToList = false; diff --git a/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture2.cs b/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture2.cs index be4f111ad69..dd860d3d778 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture2.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH1601/Fixture2.cs @@ -5,15 +5,15 @@ namespace NHibernate.Test.NHSpecificTest.NH1601 [TestFixture] public class Fixture2 : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - - /// - /// Loads the project and when Scenario2 and Scenario3 are set calls Count on the list assigned. - /// - [Test] + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; + } + + /// + /// Loads the project and when Scenario2 and Scenario3 are set calls Count on the list assigned. + /// + [Test] public void TestSaveAndLoadWithTwoCounts() { Project.TestAccessToList = false; diff --git a/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs index 29b904f7669..6b8141f40db 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs @@ -1,5 +1,6 @@ using System.Collections; using NHibernate.Criterion; +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1609 @@ -12,11 +13,6 @@ protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory) return factory.ConnectionProvider.Driver.SupportsMultipleQueries; } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public void Test() { diff --git a/src/NHibernate.Test/NHSpecificTest/NH1775/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1775/Fixture.cs index 843d320589e..d8aa1826874 100755 --- a/src/NHibernate.Test/NHSpecificTest/NH1775/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH1775/Fixture.cs @@ -9,8 +9,7 @@ public class Fixture : BugTestCase { protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is Oracle8iDialect) && - !(dialect is AbstractHanaDialect); + return !(dialect is Oracle8iDialect); } protected override void OnSetUp() diff --git a/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs index 2d71ab1fc44..0eca9db58c0 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH1812/Fixture.cs @@ -38,7 +38,7 @@ left outer join p.PeriodCollection p1 protected override bool AppliesTo(Dialect.Dialect dialect) { - return Dialect.SupportsScalarSubSelects; + return Dialect.SupportsScalarSubSelects && TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; } protected override void OnTearDown() @@ -53,4 +53,4 @@ protected override void OnTearDown() } } } -} \ No newline at end of file +} diff --git a/src/NHibernate.Test/NHSpecificTest/NH1869/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1869/Fixture.cs index 08f77492243..db540190871 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH1869/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH1869/Fixture.cs @@ -1,4 +1,5 @@ using System.Collections; +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1869 @@ -13,11 +14,6 @@ protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory) return factory.ConnectionProvider.Driver.SupportsMultipleQueries; } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - protected override void OnTearDown() { using (var session = Sfi.OpenSession()) diff --git a/src/NHibernate.Test/NHSpecificTest/NH2705/Test.cs b/src/NHibernate.Test/NHSpecificTest/NH2705/Test.cs index b785a9c3976..bec7503160f 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH2705/Test.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH2705/Test.cs @@ -19,11 +19,6 @@ private static IEnumerable GetAndFetch(string name, ISession session) wher .Where(p => p.SubItem.Name == name).ToList(); } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public void Fetch_OnComponent_ShouldNotThrow() { diff --git a/src/NHibernate.Test/NHSpecificTest/NH3050/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH3050/Fixture.cs index 15faa2cec75..ef66f7cb5ef 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH3050/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH3050/Fixture.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using NHibernate.Engine.Query; +using NHibernate.Linq; using NHibernate.Util; using NUnit.Framework; @@ -16,11 +17,6 @@ namespace NHibernate.Test.NHSpecificTest.NH3050 [TestFixture] public class Fixture : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public void Test() { diff --git a/src/NHibernate.Test/NHSpecificTest/NH386/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH386/Fixture.cs index 8f7be2d7286..10352cac845 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH386/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH386/Fixture.cs @@ -1,3 +1,4 @@ +using System; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH386 @@ -10,11 +11,6 @@ public override string BugNumber get { return "NH386"; } } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public void Query() { diff --git a/src/NHibernate.Test/NHSpecificTest/NH623/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH623/Fixture.cs index 603e19c36ba..371adb5cf2f 100644 --- a/src/NHibernate.Test/NHSpecificTest/NH623/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/NH623/Fixture.cs @@ -15,7 +15,7 @@ public override string BugNumber protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is AbstractHanaDialect); // The WHERE clause "isactive = '1'" doesn't work on HANA because idactive is a boolean + return !(dialect is HanaDialectBase); // The WHERE clause "isactive = '1'" doesn't work on HANA because idactive is a boolean } private ISession session; diff --git a/src/NHibernate.Test/NHSpecificTest/Properties/CompositePropertyRefTest.cs b/src/NHibernate.Test/NHSpecificTest/Properties/CompositePropertyRefTest.cs index bdfccc2e5af..77893017777 100644 --- a/src/NHibernate.Test/NHSpecificTest/Properties/CompositePropertyRefTest.cs +++ b/src/NHibernate.Test/NHSpecificTest/Properties/CompositePropertyRefTest.cs @@ -1,6 +1,5 @@ using System; using System.Linq; -using NHibernate.Dialect; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.Properties @@ -11,11 +10,6 @@ public class CompositePropertyRefTest : BugTestCase private long p_id; private long p2_id; - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return !(dialect is AbstractHanaDialect); // HANA doesn't support foreign key constraints over unique key columns - } - protected override void OnSetUp() { using (var s = OpenSession()) diff --git a/src/NHibernate.Test/NHSpecificTest/Properties/DynamicEntityTest.cs b/src/NHibernate.Test/NHSpecificTest/Properties/DynamicEntityTest.cs index 7481b3215f4..7c5a7ba4b16 100644 --- a/src/NHibernate.Test/NHSpecificTest/Properties/DynamicEntityTest.cs +++ b/src/NHibernate.Test/NHSpecificTest/Properties/DynamicEntityTest.cs @@ -1,6 +1,5 @@ using System.Collections; using System.Collections.Generic; -using NHibernate.Dialect; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.Properties @@ -8,11 +7,6 @@ namespace NHibernate.Test.NHSpecificTest.Properties [TestFixture] public class DynamicEntityTest : BugTestCase { - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return !(dialect is AbstractHanaDialect); // HANA doesn't support foreign key constraints over unique key columns - } - protected override void OnSetUp() { using (var s = OpenSession()) diff --git a/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs index 9ca38f7a53d..5d822391ca9 100644 --- a/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs @@ -24,11 +24,6 @@ protected override bool AppliesTo(ISessionFactoryImplementor factory) return factory.ConnectionProvider.Driver is SqlClientDriver; } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator; - } - [Test] public void NormalHqlShouldThrowUserException() { diff --git a/src/NHibernate.Test/Operations/MergeFixture.cs b/src/NHibernate.Test/Operations/MergeFixture.cs index 7cc1294428c..66c4367f82d 100644 --- a/src/NHibernate.Test/Operations/MergeFixture.cs +++ b/src/NHibernate.Test/Operations/MergeFixture.cs @@ -10,8 +10,7 @@ public class MergeFixture : AbstractOperationTestCase { protected override bool AppliesTo(Dialect.Dialect dialect) { - return !(dialect is Dialect.FirebirdDialect) && // Firebird has no CommandTimeout, and locks up during the tear-down of this fixture - (TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator); + return !(dialect is Dialect.FirebirdDialect); // Firebird has no CommandTimeout, and locks up during the tear-down of this fixture } protected override void OnTearDown() @@ -362,6 +361,9 @@ public void MergeManaged() [Test] public void MergeManyToManyWithCollectionDeference() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + // setup base data... Competition competition; using (ISession s = OpenSession()) @@ -786,6 +788,9 @@ public void PersistThenMergeInSameTxnWithVersion() [Test] public void RecursiveMergeTransient() { + if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator) + Assert.Ignore("Support of empty inserts is required"); + using (ISession s = OpenSession()) { using (ITransaction tx = s.BeginTransaction()) diff --git a/src/NHibernate.Test/SystemTransactions/SystemTransactionFixture.cs b/src/NHibernate.Test/SystemTransactions/SystemTransactionFixture.cs index 12c4cc12d1d..781c17631ce 100644 --- a/src/NHibernate.Test/SystemTransactions/SystemTransactionFixture.cs +++ b/src/NHibernate.Test/SystemTransactions/SystemTransactionFixture.cs @@ -179,8 +179,14 @@ public void CanUseSessionWithManyScopes(bool explicitFlush) // ODBC with SQL-Server always causes scopes to go distributed, which causes their transaction completion to run // asynchronously. But ODBC enlistment also check the previous transaction in a way that do not guard against it // being concurrently disposed of. See https://github.com/nhibernate/nhibernate-core/pull/1505 for more details. - Assume.That(!(Sfi.ConnectionProvider.Driver is OdbcDriver), - "ODBC sometimes fails on second scope by checking the previous transaction status, which may yield an object disposed exception"); + if (Sfi.ConnectionProvider.Driver is OdbcDriver) + Assert.Ignore("ODBC sometimes fails on second scope by checking the previous transaction status, which may yield an object disposed exception"); + // SAP HANA .Net provider always causes system transactions to be distributed, causing them to complete + // on concurrent threads. This creates race conditions when chaining scopes, the subsequent scope usage + // finding the connection still enlisted in the previous transaction, its complete being still not finished + // on its own thread. + if (Sfi.ConnectionProvider.Driver is HanaDriver) + Assert.Ignore("SAP HANA scope handling causes concurrency issues preventing chaining scope usages."); using (var s = WithOptions().ConnectionReleaseMode(ConnectionReleaseMode.OnClose).OpenSession()) { diff --git a/src/NHibernate.Test/SystemTransactions/SystemTransactionFixtureBase.cs b/src/NHibernate.Test/SystemTransactions/SystemTransactionFixtureBase.cs index 6a13a609c2a..5e587563a64 100644 --- a/src/NHibernate.Test/SystemTransactions/SystemTransactionFixtureBase.cs +++ b/src/NHibernate.Test/SystemTransactions/SystemTransactionFixtureBase.cs @@ -39,8 +39,12 @@ protected void DisableConnectionAutoEnlist(Configuration configuration) } // Purge any previous enlist connectionString = Regex.Replace( - connectionString, $"[^;\"a-zA-Z]*{autoEnlistmentKeywordPattern}=[^;\"]*", string.Empty, - RegexOptions.IgnoreCase | RegexOptions.Multiline); + connectionString, $"[^;\"a-zA-Z]*{autoEnlistmentKeywordPattern}=[^;\"]*;?", string.Empty, + RegexOptions.IgnoreCase); + // Avoid redundant semi-colon + connectionString = Regex.Replace( + connectionString, $";[/s]*$", string.Empty, + RegexOptions.IgnoreCase); connectionString += $";{autoEnlistmentKeyword}=false;"; configuration.SetProperty(Cfg.Environment.ConnectionString, connectionString); } @@ -143,4 +147,4 @@ public override void AfterTransactionCompletion(ITransaction tx) } } } -} \ No newline at end of file +} diff --git a/src/NHibernate.Test/SystemTransactions/TransactionNotificationFixture.cs b/src/NHibernate.Test/SystemTransactions/TransactionNotificationFixture.cs index 8960ce31d1b..5a8da0fc3fa 100644 --- a/src/NHibernate.Test/SystemTransactions/TransactionNotificationFixture.cs +++ b/src/NHibernate.Test/SystemTransactions/TransactionNotificationFixture.cs @@ -182,7 +182,6 @@ public void ShouldNotifyAfterDistributedTransactionWithOwnConnection(bool doComm { using (var tx = new TransactionScope()) { - ownConnection1.EnlistTransaction(System.Transactions.Transaction.Current); using (s1 = Sfi.WithOptions().Connection(ownConnection1).Interceptor(interceptor).OpenSession()) { s1.CreateCriteria().List(); diff --git a/src/NHibernate.Test/TestDialect.cs b/src/NHibernate.Test/TestDialect.cs index 050d065c21b..084f2a89359 100644 --- a/src/NHibernate.Test/TestDialect.cs +++ b/src/NHibernate.Test/TestDialect.cs @@ -27,6 +27,12 @@ public TestDialect(Dialect.Dialect dialect) _dialect = dialect; } + /// + /// Has a native generator strategy resolving to identity. + /// + public bool HasIdentityNativeGenerator + => _dialect.NativeIdentifierGeneratorClass == typeof(IdentityGenerator); + public virtual bool SupportsOperatorAll => true; public virtual bool SupportsOperatorSome => true; public virtual bool SupportsLocate => true; @@ -66,7 +72,7 @@ public TestDialect(Dialect.Dialect dialect) /// This property is useful for cases where empty inserts happens only when the entities /// generator is native while the dialect uses identity for this generator. public bool SupportsEmptyInsertsOrHasNonIdentityNativeGenerator - => SupportsEmptyInserts || _dialect.NativeIdentifierGeneratorClass != typeof(IdentityGenerator); + => SupportsEmptyInserts || !HasIdentityNativeGenerator; /// diff --git a/src/NHibernate.Test/TestDialects/HanaColumnStoreTestDialect.cs b/src/NHibernate.Test/TestDialects/HanaColumnStoreTestDialect.cs index 8a2d3b4f8ba..6ff9d0269ac 100644 --- a/src/NHibernate.Test/TestDialects/HanaColumnStoreTestDialect.cs +++ b/src/NHibernate.Test/TestDialects/HanaColumnStoreTestDialect.cs @@ -1,10 +1,10 @@ namespace NHibernate.Test.TestDialects { - public class HanaColumnStoreTestDialect : AbstractHanaTestDialect + public class HanaColumnStoreTestDialect : HanaTestDialectBase { - public HanaColumnStoreTestDialect(Dialect.Dialect dialect) - : base(dialect) - { - } + public HanaColumnStoreTestDialect(Dialect.Dialect dialect) + : base(dialect) + { + } } } diff --git a/src/NHibernate.Test/TestDialects/HanaRowStoreTestDialect.cs b/src/NHibernate.Test/TestDialects/HanaRowStoreTestDialect.cs index 1fec5201678..92b0e49cf07 100644 --- a/src/NHibernate.Test/TestDialects/HanaRowStoreTestDialect.cs +++ b/src/NHibernate.Test/TestDialects/HanaRowStoreTestDialect.cs @@ -1,10 +1,10 @@ namespace NHibernate.Test.TestDialects { - public class HanaRowStoreTestDialect : AbstractHanaTestDialect + public class HanaRowStoreTestDialect : HanaTestDialectBase { - public HanaRowStoreTestDialect(Dialect.Dialect dialect) - : base(dialect) - { - } + public HanaRowStoreTestDialect(Dialect.Dialect dialect) + : base(dialect) + { + } } } diff --git a/src/NHibernate.Test/TestDialects/AbstractHanaTestDialect.cs b/src/NHibernate.Test/TestDialects/HanaTestDialectBase.cs similarity index 50% rename from src/NHibernate.Test/TestDialects/AbstractHanaTestDialect.cs rename to src/NHibernate.Test/TestDialects/HanaTestDialectBase.cs index 1da24174114..501b8c7c649 100644 --- a/src/NHibernate.Test/TestDialects/AbstractHanaTestDialect.cs +++ b/src/NHibernate.Test/TestDialects/HanaTestDialectBase.cs @@ -1,11 +1,11 @@ namespace NHibernate.Test.TestDialects { - public abstract class AbstractHanaTestDialect : TestDialect + public abstract class HanaTestDialectBase : TestDialect { - public AbstractHanaTestDialect(Dialect.Dialect dialect) - : base(dialect) - { - } + protected HanaTestDialectBase(Dialect.Dialect dialect) + : base(dialect) + { + } public override bool SupportsComplexExpressionInGroupBy => false; diff --git a/src/NHibernate/AdoNet/HanaBatchingBatcher.cs b/src/NHibernate/AdoNet/HanaBatchingBatcher.cs index 24dfd4f4dd2..545dc504865 100644 --- a/src/NHibernate/AdoNet/HanaBatchingBatcher.cs +++ b/src/NHibernate/AdoNet/HanaBatchingBatcher.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Data.Common; -using System.Diagnostics; using System.Text; using NHibernate.AdoNet.Util; using NHibernate.Exceptions; @@ -9,7 +8,7 @@ namespace NHibernate.AdoNet { /// - /// Summary description for HanaBatchingBatcher. + /// DML batcher for HANA. /// By Jonathan Bregler /// public partial class HanaBatchingBatcher : AbstractBatcher @@ -34,7 +33,9 @@ public HanaBatchingBatcher(ConnectionManager connectionManager, IInterceptor int public override void AddToBatch(IExpectation expectation) { - Debug.Assert(CurrentCommand is ICloneable); // HanaCommands are cloneable + // HanaCommands are cloneable + if (!(CurrentCommand is ICloneable cloneableCurrentCommand)) + throw new InvalidOperationException("Current command is not an ICloneable"); var batchUpdate = CurrentCommand; Prepare(batchUpdate); @@ -61,10 +62,10 @@ public override void AddToBatch(IExpectation expectation) if (_currentBatch == null) { // use first command as the batching command - _currentBatch = (batchUpdate as ICloneable).Clone() as DbCommand; + _currentBatch = cloneableCurrentCommand.Clone() as DbCommand; } - _currentBatchCommands.Add((batchUpdate as ICloneable).Clone() as DbCommand); + _currentBatchCommands.Add(cloneableCurrentCommand.Clone() as DbCommand); _countOfCommands++; @@ -95,6 +96,8 @@ protected override void DoExecuteBatch(DbCommand ps) foreach (var command in _currentBatchCommands) { + // Batching with HANA works by simply defining multiple times each command parameter. + // (Undocumented feature explained by a developer of the provider.) foreach (DbParameter parameter in command.Parameters) { _currentBatch.Parameters.Add(parameter); diff --git a/src/NHibernate/Async/AdoNet/HanaBatchingBatcher.cs b/src/NHibernate/Async/AdoNet/HanaBatchingBatcher.cs index 957e29f070b..af028fedf37 100644 --- a/src/NHibernate/Async/AdoNet/HanaBatchingBatcher.cs +++ b/src/NHibernate/Async/AdoNet/HanaBatchingBatcher.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Data.Common; -using System.Diagnostics; using System.Text; using NHibernate.AdoNet.Util; using NHibernate.Exceptions; @@ -23,46 +22,55 @@ namespace NHibernate.AdoNet public partial class HanaBatchingBatcher : AbstractBatcher { - public override async Task AddToBatchAsync(IExpectation expectation, CancellationToken cancellationToken) + public override Task AddToBatchAsync(IExpectation expectation, CancellationToken cancellationToken) { - cancellationToken.ThrowIfCancellationRequested(); - Debug.Assert(CurrentCommand is ICloneable); // HanaCommands are cloneable + // HanaCommands are cloneable + if (!(CurrentCommand is ICloneable cloneableCurrentCommand)) + throw new InvalidOperationException("Current command is not an ICloneable"); + if (cancellationToken.IsCancellationRequested) + { + return Task.FromCanceled(cancellationToken); + } + return InternalAddToBatchAsync(); + async Task InternalAddToBatchAsync() + { - var batchUpdate = CurrentCommand; - await (PrepareAsync(batchUpdate, cancellationToken)).ConfigureAwait(false); - Driver.AdjustCommand(batchUpdate); + var batchUpdate = CurrentCommand; + await (PrepareAsync(batchUpdate, cancellationToken)).ConfigureAwait(false); + Driver.AdjustCommand(batchUpdate); - _totalExpectedRowsAffected += expectation.ExpectedRowCount; - string lineWithParameters = null; - var sqlStatementLogger = Factory.Settings.SqlStatementLogger; - if (sqlStatementLogger.IsDebugEnabled || Log.IsDebugEnabled()) - { - lineWithParameters = sqlStatementLogger.GetCommandLineWithParameters(batchUpdate); - var formatStyle = sqlStatementLogger.DetermineActualStyle(FormatStyle.Basic); - lineWithParameters = formatStyle.Formatter.Format(lineWithParameters); - _currentBatchCommandsLog.Append("command ") + _totalExpectedRowsAffected += expectation.ExpectedRowCount; + string lineWithParameters = null; + var sqlStatementLogger = Factory.Settings.SqlStatementLogger; + if (sqlStatementLogger.IsDebugEnabled || Log.IsDebugEnabled()) + { + lineWithParameters = sqlStatementLogger.GetCommandLineWithParameters(batchUpdate); + var formatStyle = sqlStatementLogger.DetermineActualStyle(FormatStyle.Basic); + lineWithParameters = formatStyle.Formatter.Format(lineWithParameters); + _currentBatchCommandsLog.Append("command ") .Append(_countOfCommands) .Append(":") .AppendLine(lineWithParameters); - } - if (Log.IsDebugEnabled()) - { - Log.Debug("Adding to batch:{0}", lineWithParameters); - } + } + if (Log.IsDebugEnabled()) + { + Log.Debug("Adding to batch:{0}", lineWithParameters); + } - if (_currentBatch == null) - { - // use first command as the batching command - _currentBatch = (batchUpdate as ICloneable).Clone() as DbCommand; - } + if (_currentBatch == null) + { + // use first command as the batching command + _currentBatch = cloneableCurrentCommand.Clone() as DbCommand; + } - _currentBatchCommands.Add((batchUpdate as ICloneable).Clone() as DbCommand); + _currentBatchCommands.Add(cloneableCurrentCommand.Clone() as DbCommand); - _countOfCommands++; + _countOfCommands++; - if (_countOfCommands >= _batchSize) - { - await (DoExecuteBatchAsync(batchUpdate, cancellationToken)).ConfigureAwait(false); + if (_countOfCommands >= _batchSize) + { + await (DoExecuteBatchAsync(batchUpdate, cancellationToken)).ConfigureAwait(false); + } } } @@ -88,6 +96,8 @@ protected override async Task DoExecuteBatchAsync(DbCommand ps, CancellationToke foreach (var command in _currentBatchCommands) { + // Batching with HANA works by simply defining multiple times each command parameter. + // (Undocumented feature explained by a developer of the provider.) foreach (DbParameter parameter in command.Parameters) { _currentBatch.Parameters.Add(parameter); diff --git a/src/NHibernate/Dialect/HanaColumnStoreDialect.cs b/src/NHibernate/Dialect/HanaColumnStoreDialect.cs index f77b850e62c..3da6fcff35a 100644 --- a/src/NHibernate/Dialect/HanaColumnStoreDialect.cs +++ b/src/NHibernate/Dialect/HanaColumnStoreDialect.cs @@ -1,14 +1,3 @@ -using System; -using System.Data; -using System.Data.Common; -using System.Text; -using NHibernate.Dialect.Function; -using NHibernate.Dialect.Schema; -using NHibernate.SqlCommand; -using NHibernate.SqlTypes; -using NHibernate.Util; -using Environment = NHibernate.Cfg.Environment; - namespace NHibernate.Dialect { /// @@ -27,22 +16,12 @@ namespace NHibernate.Dialect /// /// /// - public class HanaColumnStoreDialect : AbstractHanaDialect + public class HanaColumnStoreDialect : HanaDialectBase { - public HanaColumnStoreDialect() - { - } - /// - public override string CreateTableString - { - get { return "create column table"; } - } + public override string CreateTableString => "create column table"; /// - public override string CreateTemporaryTableString - { - get { return "create local temporary column table"; } - } + public override string CreateTemporaryTableString => "create local temporary column table"; } } diff --git a/src/NHibernate/Dialect/AbstractHanaDialect.cs b/src/NHibernate/Dialect/HanaDialectBase.cs similarity index 93% rename from src/NHibernate/Dialect/AbstractHanaDialect.cs rename to src/NHibernate/Dialect/HanaDialectBase.cs index bdc0cdac6b9..ef0dc2922a1 100644 --- a/src/NHibernate/Dialect/AbstractHanaDialect.cs +++ b/src/NHibernate/Dialect/HanaDialectBase.cs @@ -2,14 +2,12 @@ using System.Collections; using System.Data; using System.Data.Common; -using System.Text; using NHibernate.Dialect.Function; using NHibernate.Dialect.Schema; using NHibernate.Engine; using NHibernate.SqlCommand; using NHibernate.SqlTypes; using NHibernate.Type; -using NHibernate.Util; using Environment = NHibernate.Cfg.Environment; namespace NHibernate.Dialect @@ -18,7 +16,7 @@ namespace NHibernate.Dialect /// A SQL dialect base class for SAP HANA /// /// - /// The AbstractHanaDialect defaults the following configuration properties: + /// The HanaDialectBase defaults the following configuration properties: /// /// /// Property @@ -30,70 +28,62 @@ namespace NHibernate.Dialect /// /// /// - public abstract class AbstractHanaDialect : Dialect + public abstract class HanaDialectBase : Dialect { [Serializable] private class TypeConvertingVarArgsSQLFunction : ISQLFunction { - private readonly string begin; - private readonly string sep; - private readonly string end; - private SqlType type = null; - private Dialect dialect = null; + private readonly string _begin; + private readonly string _sep; + private readonly string _end; + private SqlType _type; public TypeConvertingVarArgsSQLFunction(string begin, string sep, string end) { - this.begin = begin; - this.sep = sep; - this.end = end; + _begin = begin; + _sep = sep; + _end = end; } #region ISQLFunction Members public IType ReturnType(IType columnType, IMapping mapping) { - type = columnType.SqlTypes(mapping)[0]; - dialect = mapping.Dialect; + _type = columnType.SqlTypes(mapping)[0]; return columnType; } - public bool HasArguments - { - get { return true; } - } + public bool HasArguments => true; - public bool HasParenthesesIfNoArguments - { - get { return true; } - } + public bool HasParenthesesIfNoArguments => true; public SqlString Render(IList args, ISessionFactoryImplementor factory) { - SqlStringBuilder buf = new SqlStringBuilder().Add(begin); - for (int i = 0; i < args.Count; i++) + var buf = new SqlStringBuilder().Add(_begin); + for (var i = 0; i < args.Count; i++) { - object arg = args[i]; - if (arg is SqlString && (arg as SqlString).EqualsCaseInsensitive("?")) + var arg = args[i]; + if (arg is SqlString str && str.EqualsCaseInsensitive("?")) { buf.Add("cast("); buf.AddObject(arg); buf.Add(" as "); - buf.Add(dialect.GetCastTypeName(type)); + buf.Add(factory.Dialect.GetCastTypeName(_type)); buf.Add(")"); } else { buf.AddObject(arg); } - if (i < args.Count - 1) buf.Add(sep); + if (i < args.Count - 1) buf.Add(_sep); } - return buf.Add(end).ToSqlString(); + return buf.Add(_end).ToSqlString(); } #endregion } - public AbstractHanaDialect() + protected HanaDialectBase() { //string type RegisterColumnType(DbType.AnsiStringFixedLength, "VARCHAR(255)"); @@ -419,7 +409,6 @@ protected virtual void RegisterNHibernateFunctions() RegisterFunction("chr", new StandardSQLFunction("char", NHibernateUtil.AnsiChar)); RegisterFunction("date", new SQLFunctionTemplate(NHibernateUtil.Date, "to_date(?1)")); RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); - RegisterFunction("Iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); RegisterFunction("sysdate", new NoArgSQLFunction("current_timestamp", NHibernateUtil.DateTime, false)); RegisterFunction("truncate", new SQLFunctionTemplateWithRequiredParameters(null, "floor(?1 * power(10, ?2)) / power(10, ?2)", new object[] { null, "0" })); } @@ -636,9 +625,6 @@ public override string GetColumnComment(string comment) /// public override bool SupportsColumnCheck => false; - /// - public override bool SupportsTableCheck => true; - public override IDataBaseSchema GetDataBaseSchema(DbConnection connection) { return new HanaDataBaseSchema(connection); @@ -649,8 +635,7 @@ public override IDataBaseSchema GetDataBaseSchema(DbConnection connection) #region Lock acquisition support /// - [Obsolete("Use UsesColumnsWithForUpdateOf instead")] - public override bool ForUpdateOfColumns => true; + public override bool UsesColumnsWithForUpdateOf => true; /// public override string GetForUpdateString(string aliases) @@ -691,12 +676,6 @@ public override string GenerateTemporaryTableName(string baseTableName) return false; } - /// - public override bool DropTemporaryTableAfterUse() - { - return true; - } - #endregion #endregion @@ -719,15 +698,15 @@ public override int RegisterResultSetOutParameter(DbCommand statement, int posit /// public override long TimestampResolutionInTicks - { - get { return 10L; } // Maximum precision (one tick) - } + // According to https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.02/en-US/3f81ccc7e35d44cbbc595c7d552c202a.html, + // it is supposed to have a 7 digits fractional second precision, but tests show only a 6 digits one. This is maybe a + // limitation of the data provider. + => 10L; #endregion #region Constraint support - /// public override string CascadeConstraintsString { @@ -774,7 +753,10 @@ public override string IdentityColumnString /// public override string GetSequenceNextValString(string sequenceName) { - return "select " + GetSelectSequenceNextValString(sequenceName) + " from dummy"; + // See https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.02/en-US/20d509277519101489029c064d468c5d.html, + // this seems to be the recommended way of querying a sequence. + // SYS.DUMMY is a system table having normally one row. If someone has fiddled with it, this will cause failures... + return "select " + GetSelectSequenceNextValString(sequenceName) + " from sys.dummy"; } /// @@ -803,7 +785,7 @@ protected override string GetCreateSequenceString(string sequenceName, int initi throw new MappingException("Unable to create the sequence [" + sequenceName + "]: the increment size must not be 0"); } - String createSequenceString = GetCreateSequenceString(sequenceName) + " start with " + initialValue + " increment by " + incrementSize; + var createSequenceString = GetCreateSequenceString(sequenceName) + " start with " + initialValue + " increment by " + incrementSize; if (incrementSize > 0) { if (initialValue < 1) @@ -841,9 +823,6 @@ public override string ToBooleanValueString(bool value) return value ? "true" : "false"; } - /// - public override bool SupportsConcurrentWritingConnectionsInSameTransaction => false; - #endregion #region Limit/offset support @@ -882,10 +861,6 @@ public override SqlString GetLimitString(SqlString queryString, SqlString offset #endregion - #region Identifier quoting support - - #endregion - #region Union subclass support /// @@ -946,9 +921,6 @@ public override string GetSelectClauseNullString(SqlType sqlType) /// public override bool SupportsRowValueConstructorSyntaxInInList => true; - /// - public override bool SupportsCircularCascadeDeleteConstraints => false; - /// public override bool SupportsExpectedLobUsagePattern => false; @@ -958,46 +930,28 @@ public override string GetSelectClauseNullString(SqlType sqlType) /// public override bool SupportsExistsInSelect => false; - /// - public override bool SupportsScalarSubSelects => false; - #endregion - /// public override string SelectGUIDString - { - get { return "select sysuuid from dummy"; } - } + // SYS.DUMMY is a system table having normally one row. If someone has fiddled with it, this will cause failures... + => "select sysuuid from sys.dummy"; /// public override bool IsCurrentTimestampSelectStringCallable => false; /// public override string CurrentTimestampSelectString - { - get { return "select current_timestamp from dummy"; } - } - - /// - public override string NoColumnsInsertString - { - get { throw new MappingException("HANA does not support inserting a row without specifying any column values"); } - } + // SYS.DUMMY is a system table having normally one row. If someone has fiddled with it, this will cause failures... + => "select current_timestamp from sys.dummy"; /// public override int MaxAliasLength => 128; /// - public override string AddColumnString - { - get { return "add ("; } - } + public override string AddColumnString => "add ("; /// - public override string AddColumnSuffixString - { - get { return ")"; } - } + public override string AddColumnSuffixString => ")"; } } diff --git a/src/NHibernate/Dialect/HanaRowStoreDialect.cs b/src/NHibernate/Dialect/HanaRowStoreDialect.cs index af620c028fb..87ce928e12b 100644 --- a/src/NHibernate/Dialect/HanaRowStoreDialect.cs +++ b/src/NHibernate/Dialect/HanaRowStoreDialect.cs @@ -1,14 +1,3 @@ -using System; -using System.Data; -using System.Data.Common; -using System.Text; -using NHibernate.Dialect.Function; -using NHibernate.Dialect.Schema; -using NHibernate.SqlCommand; -using NHibernate.SqlTypes; -using NHibernate.Util; -using Environment = NHibernate.Cfg.Environment; - namespace NHibernate.Dialect { /// @@ -27,22 +16,12 @@ namespace NHibernate.Dialect /// /// /// - public class HanaRowStoreDialect : AbstractHanaDialect + public class HanaRowStoreDialect : HanaDialectBase { - public HanaRowStoreDialect() - { - } - /// - public override string CreateTableString - { - get { return "create row table"; } - } + public override string CreateTableString => "create row table"; /// - public override string CreateTemporaryTableString - { - get { return "create local temporary row table"; } - } + public override string CreateTemporaryTableString => "create local temporary row table"; } } diff --git a/src/NHibernate/Dialect/Schema/HanaMetaData.cs b/src/NHibernate/Dialect/Schema/HanaMetaData.cs index 6c295d5630e..c1125d5bb32 100644 --- a/src/NHibernate/Dialect/Schema/HanaMetaData.cs +++ b/src/NHibernate/Dialect/Schema/HanaMetaData.cs @@ -36,47 +36,47 @@ public override ISet GetReservedWords() return result; } - + public override DataTable GetTables(string catalog, string schemaPattern, string tableNamePattern, string[] types) { - var restrictions = new[] {schemaPattern, tableNamePattern, null}; + var restrictions = new[] { schemaPattern, tableNamePattern, null }; DataTable objTbl = Connection.GetSchema("Tables", restrictions); return objTbl; } public override DataTable GetIndexInfo(string catalog, string schemaPattern, string tableName) { - var restrictions = new[] {schemaPattern, tableName, null}; + var restrictions = new[] { schemaPattern, tableName, null }; DataTable objTbl = Connection.GetSchema("Indexes", restrictions); return objTbl; } public override DataTable GetIndexColumns(string catalog, string schemaPattern, string tableName, string indexName) { - var restrictions = new[] {schemaPattern, tableName, indexName, null}; + var restrictions = new[] { schemaPattern, tableName, indexName, null }; DataTable objTbl = Connection.GetSchema("IndexColumns", restrictions); return objTbl; } - public override DataTable GetColumns(string catalog, string schemaPattern, string tableNamePattern, - string columnNamePattern) + public override DataTable GetColumns( + string catalog, + string schemaPattern, + string tableNamePattern, + string columnNamePattern) { - var restrictions = new[] {schemaPattern, tableNamePattern, null}; + var restrictions = new[] { schemaPattern, tableNamePattern, null }; DataTable objTbl = Connection.GetSchema("Columns", restrictions); return objTbl; } public override DataTable GetForeignKeys(string catalog, string schema, string table) { - var restrictions = new[] {schema, table, null}; + var restrictions = new[] { schema, table, null }; DataTable objTbl = Connection.GetSchema("ForeignKeys", restrictions); return objTbl; } - public override bool StoresUpperCaseIdentifiers - { - get { return true; } - } + public override bool StoresUpperCaseIdentifiers => true; } public class HanaTableMetadata : AbstractTableMetadata @@ -95,7 +95,7 @@ protected override void ParseTableInfo(DataRow rs) protected override string GetConstraintName(DataRow rs) { - return Convert.ToString(rs["CONSTRAINT_NAME"]); + return Convert.ToString(rs["CONSTRAINT_NAME"]); } protected override string GetColumnName(DataRow rs) @@ -130,9 +130,9 @@ public HanaColumnMetadata(DataRow rs) : base(rs) { Name = Convert.ToString(rs["COLUMN_NAME"]); - - this.SetColumnSize(rs["CHARACTER_MAXIMUM_LENGTH"]); - this.SetNumericalPrecision(rs["NUMERIC_PRECISION"]); + + SetColumnSize(rs["CHARACTER_MAXIMUM_LENGTH"]); + SetNumericalPrecision(rs["NUMERIC_PRECISION"]); Nullable = Convert.ToString(rs["IS_NULLABLE"]); TypeName = Convert.ToString(rs["DATA_TYPE"]); diff --git a/src/NHibernate/Driver/HanaDriver.cs b/src/NHibernate/Driver/HanaDriver.cs index de7e2af9c10..850b01f6c22 100644 --- a/src/NHibernate/Driver/HanaDriver.cs +++ b/src/NHibernate/Driver/HanaDriver.cs @@ -1,4 +1,3 @@ -using System; using NHibernate.AdoNet; namespace NHibernate.Driver @@ -34,32 +33,34 @@ public HanaDriver() : base( } /// + /// + /// Named parameters are not supported by the SAP HANA .Net provider. + /// https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.02/en-US/d197835a6d611014a07fd73ee6fed6eb.html + /// public override bool UseNamedPrefixInSql => false; /// public override bool UseNamedPrefixInParameter => false; /// - public override string NamedPrefix => String.Empty; - - public override bool SupportsMultipleOpenReaders => false; + public override string NamedPrefix => string.Empty; public override IResultSetsCommand GetResultSetsCommand(Engine.ISessionImplementor session) { return new BasicResultSetsCommand(session); } - public override bool SupportsSystemTransactions => true; - + /// + /// It does support it indeed, provided any previous transaction has finished completing. But scopes + /// are always promoted to distributed with HanaConnection, which causes them to complete on concurrent + /// threads. This creates race conditions with following a scope disposal. As this null enlistment feature + /// is here for attemptinng de-enlisting a connection from a completed transaction not yet cleaned-up, and as + /// HanaConnection does not handle such a case, better disable it. + /// public override bool SupportsNullEnlistment => false; public override bool RequiresTimeSpanForTime => true; - public override bool HasDelayedDistributedTransactionCompletion => false; - - /// - public override bool SupportsEnlistmentWhenAutoEnlistmentIsDisabled => false; - System.Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass => typeof(HanaBatchingBatcherFactory); } }