shared: qssquery: Fix sqlerror if sort condition comes last
If we had something like c:(test) sort:(mtime, desc), then we would run into an sql error eventually, since we would have added an implicit AND token before the sort condition. This is wrong, as a sort is not a filter. So, as a quick hack to fix this, just remove a preceeding boolean (as dirty as it may be, but it does the job for now).
This commit is contained in:
parent
ee4fe51a77
commit
e88d0e57b2
@ -276,6 +276,11 @@ QSSQuery QSSQuery::build(QString expression)
|
|||||||
{
|
{
|
||||||
throw QSSGeneralException("Two sort statements are illegal");
|
throw QSSGeneralException("Two sort statements are illegal");
|
||||||
}
|
}
|
||||||
|
// TODO: hack, since we are not a "filter", we must remove a preceeding (implicit) boolean
|
||||||
|
if(result.tokens.last().type & BOOL == BOOL)
|
||||||
|
{
|
||||||
|
result.tokens.pop_back();
|
||||||
|
}
|
||||||
result.sortConditions = createSortConditions(value);
|
result.sortConditions = createSortConditions(value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user