mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add a special case: a termless, match-any query
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8866 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
59d7daabc6
commit
a4bf3b2142
@ -360,11 +360,14 @@ check_object (QofQuery *q, gpointer object)
|
|||||||
QofQueryTerm * qt;
|
QofQueryTerm * qt;
|
||||||
int and_terms_ok=1;
|
int and_terms_ok=1;
|
||||||
|
|
||||||
for(or_ptr = q->terms; or_ptr; or_ptr = or_ptr->next) {
|
for(or_ptr = q->terms; or_ptr; or_ptr = or_ptr->next)
|
||||||
|
{
|
||||||
and_terms_ok = 1;
|
and_terms_ok = 1;
|
||||||
for(and_ptr = or_ptr->data; and_ptr; and_ptr = and_ptr->next) {
|
for(and_ptr = or_ptr->data; and_ptr; and_ptr = and_ptr->next)
|
||||||
|
{
|
||||||
qt = (QofQueryTerm *)(and_ptr->data);
|
qt = (QofQueryTerm *)(and_ptr->data);
|
||||||
if (qt->param_fcns && qt->pred_fcn) {
|
if (qt->param_fcns && qt->pred_fcn)
|
||||||
|
{
|
||||||
GSList *node;
|
GSList *node;
|
||||||
QofAccessFunc get_fcn;
|
QofAccessFunc get_fcn;
|
||||||
gpointer conv_obj = object;
|
gpointer conv_obj = object;
|
||||||
@ -380,19 +383,30 @@ check_object (QofQuery *q, gpointer object)
|
|||||||
conv_obj = get_fcn (conv_obj);
|
conv_obj = get_fcn (conv_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((qt->pred_fcn)(conv_obj, get_fcn, qt->pdata))
|
if (((qt->pred_fcn)(conv_obj, get_fcn, qt->pdata)) == qt->invert)
|
||||||
== qt->invert) {
|
{
|
||||||
and_terms_ok = 0;
|
and_terms_ok = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* XXX: Don't know how to do this conversion -- do we care? */
|
/* XXX: Don't know how to do this conversion -- do we care? */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(and_terms_ok) {
|
if (and_terms_ok)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there are no terms, assume a "match any" applies.
|
||||||
|
* A query with no terms is still meaningful, since the user
|
||||||
|
* may want to get all objects, but in a particular sorted
|
||||||
|
* order.
|
||||||
|
*/
|
||||||
|
if (NULL == q->terms) return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user