Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes offset limit duplication fo sqlServer #490

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/YesSql.Provider.SqlServer/SqlServerDialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ public override string GetTypeName(DbType dbType, int? length, byte? precision,

public override void Page(ISqlBuilder sqlBuilder, string offset, string limit)
{
sqlBuilder.ClearTrail();
sebastienros marked this conversation as resolved.
Show resolved Hide resolved

if (offset != null)
{
sqlBuilder.Trail(" OFFSET ");
Expand Down
5 changes: 4 additions & 1 deletion test/YesSql.Tests/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task InitializeAsync()
if (_configuration == null)
{
_configuration = CreateConfiguration();

CleanDatabase(_configuration, false);

_store = await StoreFactory.CreateAndInitializeAsync(_configuration);
Expand Down Expand Up @@ -2914,6 +2914,9 @@ public async Task ShouldPageResults()
{
Assert.Equal(1, String.Compare(ordered[i].SomeName, ordered[i - 1].SomeName));
}

//query should discard previous skip/take
Assert.Equal(5, (await query.Skip(10).Take(5).ListAsync()).Count());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create a new test for this?

}
}

Expand Down
Loading