I have a generic method to return a list of a certain type of data on my CBL database. I have implemented pagination, as that makes sense for some of the queries. But for others I just want all.
So I have this code:
Expression.Int(limit);
using (var query = QueryBuilder.Select(
SelectResult.All())
.From(dbSource)
.Where(_condition)
.OrderBy(_orderBy)
.Limit(Expression.Int(limit), Expression.Int(offset)))
{
var result = query?.Execute()?.AllResults();
:
limit is an integer. Question: is there a way where I can set the Limit expression to “All”?
Obviously, I see two “clumpsy” solutions. One is to override the limit by setting it to e.g. 10000. The other is to create an almost identical query - just without the limit expression…
You are right. It doesn’t seem that limit of “ALL” is supported with -1 - even on v2.6. You could do what you suggested (int max) as a workaround but If you are not interested in pagination, then you can remove the limit clause altogether and it should just get everything from offset 0.
Well, yes - I cannot remove the condition without affecting the other doc. types - without having two query statements. So I’ll just bump it up very high…
… but it would make sense to make it work as unlimited with either “0” or “-1”
Sorry I led you astray — I thought -1 would work since AFAIK we just pass the value into a SQLite LIMIT clause. Sounds like somewhere in the code we’re trying to be “smart” and pinning it to zero…