-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added limit SQL generation for SQL Server queries with comments, common table expressions, and stored procedure invocations. - Modified loader to fall back to client-side limit/offset behavior if dialect does not support generation of server side limit/offset SQL for a given (custom) SQL statement.
- Loading branch information
Showing
12 changed files
with
743 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/NHibernate.Test/NHSpecificTest/NH2977/FixtureByCode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using NHibernate.Cfg.MappingSchema; | ||
using NUnit.Framework; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NH2977 | ||
{ | ||
/// <summary> | ||
/// Fixture using 'by code' mappings | ||
/// </summary> | ||
/// <remarks> | ||
/// This fixture is identical to <see cref="Fixture" /> except the <see cref="Entity" /> mapping is performed | ||
/// by code in the GetMappings method, and does not require the <c>Mappings.hbm.xml</c> file. Use this approach | ||
/// if you prefer. | ||
/// </remarks> | ||
public class ByCodeFixture : TestCaseMappingByCode | ||
{ | ||
protected override HbmMapping GetMappings() | ||
{ | ||
return new HbmMapping(); | ||
} | ||
|
||
protected override bool AppliesTo(Dialect.Dialect dialect) | ||
{ | ||
return dialect is Dialect.MsSql2000Dialect; | ||
} | ||
|
||
[Test] | ||
public void CanGetUniqueStoredProcedureResult() | ||
{ | ||
using (ISession session = OpenSession()) | ||
using (session.BeginTransaction()) | ||
{ | ||
var result = session.CreateSQLQuery("EXEC sp_stored_procedures ?") | ||
.SetString(0, "sp_help") | ||
.UniqueResult(); | ||
Assert.That(result, Is.Not.Null); | ||
} | ||
} | ||
|
||
[Test] | ||
public void CanLimitStoredProcedureResults() | ||
{ | ||
using (ISession session = OpenSession()) | ||
using (session.BeginTransaction()) | ||
{ | ||
var result = session.CreateSQLQuery("EXEC sp_stored_procedures") | ||
.SetMaxResults(5) | ||
.List(); | ||
Assert.That(result, Has.Count.EqualTo(5)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,4 +103,4 @@ public override string AppendLockHint(LockMode lockMode, string tableName) | |
return tableName; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.