Skip to content

Commit 4583cee

Browse files
committed
Don't use ApplyLimit with With clauses
1 parent 0a5a4fb commit 4583cee

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

CommonAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
// COM, set the ComVisible attribute to true on that type.
2020
[assembly: ComVisible(false)]
2121

22-
[assembly: AssemblyVersion("0.17.1.1")]
23-
[assembly: AssemblyFileVersion("0.17.1.1")]
22+
[assembly: AssemblyVersion("0.18.0.0")]
23+
[assembly: AssemblyFileVersion("0.18.0.0")]
2424

Simple.Data.Ado/AdoAdapterQueryRunner.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private ICommandBuilder[] GetPagedQueryCommandBuilders(ref SimpleQuery query, In
151151
}
152152
else
153153
{
154-
ApplyPaging(commandBuilders, mainCommandBuilder, skipClause, takeClause, queryPager);
154+
ApplyPaging(commandBuilders, mainCommandBuilder, skipClause, takeClause, query.Clauses.OfType<WithClause>().Any(), queryPager);
155155
}
156156
}
157157
return commandBuilders.ToArray();
@@ -168,21 +168,20 @@ private void DeferPaging(ref SimpleQuery query, ICommandBuilder mainCommandBuild
168168
commandBuilders.Add(commandBuilder);
169169
}
170170

171-
private void ApplyPaging(List<ICommandBuilder> commandBuilders, ICommandBuilder mainCommandBuilder, SkipClause skipClause,
172-
TakeClause takeClause, IQueryPager queryPager)
171+
private void ApplyPaging(List<ICommandBuilder> commandBuilders, ICommandBuilder mainCommandBuilder, SkipClause skipClause, TakeClause takeClause, bool hasWithClause, IQueryPager queryPager)
173172
{
174173
const int maxInt = 2147483646;
175174

176175
IEnumerable<string> commandTexts;
177-
if (skipClause == null)
176+
if (skipClause == null && !hasWithClause)
178177
{
179178
commandTexts = queryPager.ApplyLimit(mainCommandBuilder.Text, takeClause.Count);
180179
}
181180
else
182181
{
183-
if (takeClause == null) takeClause = new TakeClause(maxInt);
184-
commandTexts = queryPager.ApplyPaging(mainCommandBuilder.Text, skipClause.Count,
185-
takeClause.Count);
182+
int skip = skipClause == null ? 0 : skipClause.Count;
183+
int take = takeClause == null ? maxInt : takeClause.Count;
184+
commandTexts = queryPager.ApplyPaging(mainCommandBuilder.Text, skip, take);
186185
}
187186

188187
commandBuilders.AddRange(

Simple.Data.InMemoryTest/Simple.Data.InMemoryTest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<Compile Include="InMemoryTests.cs" />
6161
<Compile Include="NameResolutionTest.cs" />
6262
<Compile Include="Properties\AssemblyInfo.cs" />
63+
<Compile Include="SimpleQueryConversionTests.cs" />
6364
</ItemGroup>
6465
<ItemGroup>
6566
<None Include="packages.config" />

0 commit comments

Comments
 (0)