27 #include <sys/types.h>
36 #include "qofclass-p.h"
37 #include "qofquery-p.h"
38 #include "qofquerycore-p.h"
54 QofQueryPredicateFunc pred_fcn;
71 QofCompareFunc comp_fcn;
86 QofQuerySort primary_sort;
87 QofQuerySort secondary_sort;
88 QofQuerySort tertiary_sort;
98 GHashTable *be_compiled;
107 typedef struct _QofQueryCB
116 query_init (
QofQuery * q, QofQueryTerm * initial_term)
124 or = g_list_alloc ();
125 and = g_list_alloc ();
126 and->data = initial_term;
133 g_list_free (q->results);
134 g_list_free (q->books);
136 g_slist_free (q->primary_sort.param_list);
137 g_slist_free (q->secondary_sort.param_list);
138 g_slist_free (q->tertiary_sort.param_list);
140 g_slist_free (q->primary_sort.param_fcns);
141 g_slist_free (q->secondary_sort.param_fcns);
142 g_slist_free (q->tertiary_sort.param_fcns);
145 memset (q, 0,
sizeof (*q));
152 q->primary_sort.param_list =
154 q->primary_sort.increasing = TRUE;
155 q->secondary_sort.increasing = TRUE;
156 q->tertiary_sort.increasing = TRUE;
168 q1->terms = q2->terms;
172 q1->books = q2->books;
180 free_query_term (QofQueryTerm * qt)
186 g_slist_free (qt->param_list);
187 g_slist_free (qt->param_fcns);
191 static QofQueryTerm *
192 copy_query_term (QofQueryTerm * qt)
194 QofQueryTerm *new_qt;
198 new_qt = g_new0 (QofQueryTerm, 1);
199 memcpy (new_qt, qt,
sizeof (QofQueryTerm));
200 new_qt->param_list = g_slist_copy (qt->param_list);
201 new_qt->param_fcns = g_slist_copy (qt->param_fcns);
207 copy_and_terms (GList * and_terms)
212 for (cur_and = and_terms; cur_and; cur_and = cur_and->next)
214 and = g_list_prepend (and, copy_query_term (cur_and->data));
217 return g_list_reverse (and);
221 copy_or_terms (GList * or_terms)
226 for (cur_or = or_terms; cur_or; cur_or = cur_or->next)
228 or = g_list_prepend (or, copy_and_terms (cur_or->data));
231 return g_list_reverse (or);
235 copy_sort (QofQuerySort * dst,
const QofQuerySort * src)
237 memcpy (dst, src,
sizeof (*dst));
238 dst->param_list = g_slist_copy (src->param_list);
239 dst->param_fcns = g_slist_copy (src->param_fcns);
243 free_sort (QofQuerySort * s)
245 g_slist_free (s->param_list);
246 s->param_list = NULL;
248 g_slist_free (s->param_fcns);
249 s->param_fcns = NULL;
260 for (cur_or = q->terms; cur_or; cur_or = cur_or->next)
264 for (cur_and = cur_or->data; cur_and; cur_and = cur_and->next)
266 free_query_term (cur_and->data);
267 cur_and->data = NULL;
270 g_list_free (cur_or->data);
274 free_sort (&(q->primary_sort));
275 free_sort (&(q->secondary_sort));
276 free_sort (&(q->tertiary_sort));
278 g_list_free (q->terms);
281 g_list_free (q->books);
284 g_list_free (q->results);
289 cmp_func (QofQuerySort * sort,
QofSortFunc default_sort,
290 gconstpointer a, gconstpointer b)
294 gpointer conva, convb;
296 g_return_val_if_fail (sort, 0);
299 if (sort->use_default)
302 return default_sort (a, b);
307 if (!sort->param_fcns)
311 if (!sort->comp_fcn && !sort->obj_cmp)
315 conva = (gpointer) a;
316 convb = (gpointer) b;
317 for (node = sort->param_fcns; node; node = node->next)
323 if (!node->next && !sort->obj_cmp)
327 conva = (param->param_getfcn) (conva, param);
328 convb = (param->param_getfcn) (convb, param);
334 gint rc = sort->comp_fcn (conva, convb, sort->options, param);
338 return sort->obj_cmp (conva, convb);
344 sort_func (gconstpointer a, gconstpointer b)
348 g_return_val_if_fail (sortQuery, 0);
351 cmp_func (&(sortQuery->primary_sort), sortQuery->defaultSort, a,
356 cmp_func (&(sortQuery->secondary_sort),
357 sortQuery->defaultSort,
362 cmp_func (&(sortQuery->tertiary_sort),
363 sortQuery->defaultSort, a, b);
364 return sortQuery->tertiary_sort.increasing ?
369 return sortQuery->secondary_sort.increasing ?
375 return sortQuery->primary_sort.increasing ? retval : -retval;
386 check_object (
QofQuery * q, gpointer
object)
391 gint and_terms_ok = 1;
393 for (or_ptr = q->terms; or_ptr; or_ptr = or_ptr->next)
396 for (and_ptr = or_ptr->data; and_ptr; and_ptr = and_ptr->next)
398 qt = (QofQueryTerm *) (and_ptr->data);
399 if (qt->param_fcns && qt->pred_fcn)
403 gpointer conv_obj = object;
406 for (node = qt->param_fcns; node; node = node->next)
414 conv_obj = param->param_getfcn (conv_obj, param);
417 if (((qt->pred_fcn) (conv_obj, param,
418 qt->pdata)) == qt->invert)
440 if (NULL == q->terms)
452 compile_params (GSList * param_list,
QofIdType start_obj,
458 ENTER (
"param_list=%p id=%s", param_list, start_obj);
459 g_return_val_if_fail (param_list, NULL);
460 g_return_val_if_fail (start_obj, NULL);
461 g_return_val_if_fail (
final, NULL);
463 for (; param_list; param_list = param_list->next)
473 fcns = g_slist_prepend (fcns, (gpointer) objDef);
479 start_obj = (
QofIdType) objDef->param_type;
482 LEAVE (
"fcns=%p", fcns);
483 return (g_slist_reverse (fcns));
487 compile_sort (QofQuerySort * sort,
QofIdType obj)
491 ENTER (
"sort=%p id=%s params=%p", sort, obj, sort->param_list);
492 sort->use_default = FALSE;
494 g_slist_free (sort->param_fcns);
495 sort->param_fcns = NULL;
496 sort->comp_fcn = NULL;
497 sort->obj_cmp = NULL;
500 if (!sort->param_list)
507 sort->param_fcns = compile_params (sort->param_list, obj, &resObj);
512 if (sort->param_fcns)
514 sort->comp_fcn = qof_query_core_get_compare (resObj->param_type);
517 if (sort->comp_fcn == NULL)
520 qof_class_get_default_sort (resObj->param_type);
525 sort->use_default = TRUE;
527 LEAVE (
"sort=%p id=%s", sort, obj);
533 GList *or_ptr, *and_ptr, *node;
535 ENTER (
" query=%p", q);
539 for (or_ptr = q->terms; or_ptr; or_ptr = or_ptr->next)
541 for (and_ptr = or_ptr->data; and_ptr; and_ptr = and_ptr->next)
543 QofQueryTerm *qt = and_ptr->data;
546 g_slist_free (qt->param_fcns);
547 qt->param_fcns = NULL;
550 qt->param_fcns = compile_params (qt->param_list, q->search_for,
559 qof_query_core_get_predicate (resObj->param_type);
566 compile_sort (&(q->primary_sort), q->search_for);
567 compile_sort (&(q->secondary_sort), q->search_for);
568 compile_sort (&(q->tertiary_sort), q->search_for);
570 q->defaultSort = qof_class_get_default_sort (q->search_for);
573 for (node = q->books; node; node = node->next)
578 if (be && be->compile_query)
580 gpointer result = (be->compile_query) (be, q);
582 g_hash_table_insert (q->be_compiled, book, result);
585 LEAVE (
" query=%p", q);
589 check_item_cb (gpointer
object, gpointer user_data)
591 QofQueryCB *ql = user_data;
596 if (check_object (ql->query,
object))
598 ql->list = g_list_prepend (ql->list,
object);
605 param_list_cmp (GSList * l1, GSList * l2)
629 merge_books (GList * l1, GList * l2)
634 res = g_list_copy (l1);
636 for (node = l2; node; node = node->next)
638 if (g_list_index (res, node->data) == -1)
639 res = g_list_prepend (res, node->data);
646 query_free_compiled (gpointer key, gpointer value,
647 gpointer user_data __attribute__ ((unused)))
652 if (be && be->free_query)
653 (be->free_query) (be, value);
662 g_hash_table_foreach_remove (q->be_compiled, query_free_compiled,
670 qof_query_build_param_list (gchar
const *param, ...)
672 GSList *param_list = NULL;
673 gchar
const *this_param;
679 va_start (ap, param);
681 for (this_param = param; this_param;
682 this_param = va_arg (ap,
const gchar *))
683 param_list = g_slist_prepend (param_list, (gpointer) this_param);
687 return g_slist_reverse (param_list);
697 if (!q || !param_list || !pred_data)
700 qt = g_new0 (QofQueryTerm, 1);
701 qt->param_list = param_list;
702 qt->pdata = pred_data;
722 if (!q || !param_list)
725 for (or = q->terms; or; or = or->next)
727 for (and = or->data; and; and = and->next)
730 if (!param_list_cmp (qt->param_list, param_list))
732 if (g_list_length (or->data) == 1)
734 q->terms = g_list_remove_link (q->terms, or);
741 or->data = g_list_remove_link (or->data, and);
748 free_query_term (qt);
759 GList *matching_objects = NULL;
761 gint object_count = 0;
765 g_return_val_if_fail (q->search_for, NULL);
766 g_return_val_if_fail (q->books, NULL);
774 query_clear_compiles (q);
786 memset (&qcb, 0,
sizeof (qcb));
790 for (node = q->books; node; node = node->next)
798 gpointer compiled_query =
799 g_hash_table_lookup (q->be_compiled, book);
801 if (compiled_query && be->run_query)
803 (be->run_query) (be, compiled_query);
812 matching_objects = qcb.list;
813 object_count = qcb.count;
815 PINFO (
"matching objects=%p count=%d", matching_objects, object_count);
823 matching_objects = g_list_reverse (matching_objects);
829 if (q->primary_sort.comp_fcn || q->primary_sort.obj_cmp ||
830 (q->primary_sort.use_default && q->defaultSort))
833 matching_objects = g_list_sort (matching_objects, sort_func);
838 if ((object_count > q->max_results) && (q->max_results > -1))
840 if (q->max_results > 0)
846 g_list_nth (matching_objects,
847 object_count - q->max_results);
851 if (mptr->prev != NULL)
852 mptr->prev->next = NULL;
855 g_list_free (matching_objects);
856 matching_objects = mptr;
861 g_list_free (matching_objects);
862 matching_objects = NULL;
864 object_count = q->max_results;
869 g_list_free (q->results);
870 q->results = matching_objects;
873 return matching_objects;
882 return query->results;
889 swap_terms (query, q2);
892 g_list_free (query->books);
894 g_list_free (query->results);
895 query->results = NULL;
903 qp->be_compiled = g_hash_table_new (g_direct_hash, g_direct_equal);
904 query_init (qp, NULL);
937 return g_list_length (q->terms);
947 for (o = q->terms; o; o = o->next)
948 n += g_list_length (o->data);
958 if (!q || !term_param)
961 for (or = q->terms; or; or = or->next)
963 for (and = or->data; and; and = and->next)
965 QofQueryTerm *qt = and->data;
966 if (!param_list_cmp (term_param, qt->param_list))
975 qof_query_get_term_type (
QofQuery * q, GSList * term_param)
979 GSList *results = NULL;
981 if (!q || !term_param)
984 for (or = q->terms; or; or = or->next)
986 for (and = or->data; and; and = and->next)
988 QofQueryTerm *qt = and->data;
989 if (!param_list_cmp (term_param, qt->param_list))
990 results = g_slist_append (results, qt->pdata);
1003 query_clear_compiles (q);
1004 g_hash_table_destroy (q->be_compiled);
1017 ht = copy->be_compiled;
1018 free_members (copy);
1020 memcpy (copy, q,
sizeof (
QofQuery));
1022 copy->be_compiled = ht;
1023 copy->terms = copy_or_terms (q->terms);
1024 copy->books = g_list_copy (q->books);
1025 copy->results = g_list_copy (q->results);
1027 copy_sort (&(copy->primary_sort), &(q->primary_sort));
1028 copy_sort (&(copy->secondary_sort), &(q->secondary_sort));
1029 copy_sort (&(copy->tertiary_sort), &(q->tertiary_sort));
1046 QofQuery *right, *left, *iright, *ileft;
1056 num_or_terms = g_list_length (q->terms);
1058 switch (num_or_terms)
1062 retval->max_results = q->max_results;
1069 retval->max_results = q->max_results;
1070 retval->books = g_list_copy (q->books);
1071 retval->search_for = q->search_for;
1072 retval->changed = 1;
1074 aterms = g_list_nth_data (q->terms, 0);
1076 for (cur = aterms; cur; cur = cur->next)
1078 qt = copy_query_term (cur->data);
1079 qt->invert = !(qt->invert);
1080 new_oterm = g_list_append (NULL, qt);
1085 retval->terms = g_list_reverse (retval->terms);
1086 retval->terms = g_list_prepend (retval->terms, new_oterm);
1087 retval->terms = g_list_reverse (retval->terms);
1096 right->terms = copy_or_terms (g_list_nth (q->terms, 1));
1099 left->terms = g_list_append (NULL,
1100 copy_and_terms (g_list_nth_data (q->terms, 0)));
1106 retval->books = g_list_copy (q->books);
1107 retval->max_results = q->max_results;
1108 retval->search_for = q->search_for;
1109 retval->changed = 1;
1141 if (q1->search_for && q2->search_for)
1142 g_return_val_if_fail (
safe_strcmp (q1->search_for,
1143 q2->search_for) == 0, NULL);
1145 search_for = (q1->search_for ? q1->search_for : q2->search_for);
1166 g_list_concat (copy_or_terms (q1->terms),
1167 copy_or_terms (q2->terms));
1168 retval->books = merge_books (q1->books, q2->books);
1169 retval->max_results = q1->max_results;
1170 retval->changed = 1;
1175 retval->books = merge_books (q1->books, q2->books);
1176 retval->max_results = q1->max_results;
1177 retval->changed = 1;
1183 for (i = q1->terms; i; i = i->next)
1185 for (j = q2->terms; j; j = j->next)
1188 g_list_prepend (retval->terms,
1190 (copy_and_terms (i->data), copy_and_terms (j->data)));
1193 retval->terms = g_list_reverse (retval->terms);
1196 case QOF_QUERY_NAND:
1229 retval->search_for = search_for;
1242 swap_terms (q1, tmp_q);
1248 GSList * params1, GSList * params2, GSList * params3)
1252 if (q->primary_sort.param_list)
1253 g_slist_free (q->primary_sort.param_list);
1254 q->primary_sort.param_list = params1;
1255 q->primary_sort.options = 0;
1257 if (q->secondary_sort.param_list)
1258 g_slist_free (q->secondary_sort.param_list);
1259 q->secondary_sort.param_list = params2;
1260 q->secondary_sort.options = 0;
1262 if (q->tertiary_sort.param_list)
1263 g_slist_free (q->tertiary_sort.param_list);
1264 q->tertiary_sort.param_list = params3;
1265 q->tertiary_sort.options = 0;
1271 qof_query_set_sort_options (
QofQuery * q, gint prim_op, gint sec_op,
1276 q->primary_sort.options = prim_op;
1277 q->secondary_sort.options = sec_op;
1278 q->tertiary_sort.options = tert_op;
1283 gboolean sec_inc, gboolean tert_inc)
1287 q->primary_sort.increasing = prim_inc;
1288 q->secondary_sort.increasing = sec_inc;
1289 q->tertiary_sort.increasing = tert_inc;
1306 if (!q || !param_list)
1310 g_return_if_fail (options == QOF_GUID_MATCH_NULL);
1312 pdata = qof_query_guid_predicate (options, guid_list);
1322 if (!q || !param_list)
1326 g = g_list_prepend (g, (gpointer) guid);
1337 GSList *slist = NULL;
1342 if (g_list_index (q->books, book) == -1)
1343 q->books = g_list_prepend (q->books, book);
1345 slist = g_slist_prepend (slist, QOF_PARAM_GUID);
1364 if (!q || !param_list)
1367 pdata = qof_query_boolean_predicate (QOF_COMPARE_EQUAL, value);
1378 qof_query_core_init ();
1381 LEAVE (
"Completed initialization of QofQuery");
1385 qof_query_shutdown (
void)
1387 qof_class_shutdown ();
1388 qof_query_core_shutdown ();
1392 qof_query_get_max_results (
QofQuery * q)
1396 return q->max_results;
1404 return q->search_for;
1416 qof_query_term_get_param_path (QofQueryTerm * qt)
1420 return qt->param_list;
1424 qof_query_term_get_pred_data (QofQueryTerm * qt)
1432 qof_query_term_is_inverted (QofQueryTerm * qt)
1440 qof_query_get_sorts (
QofQuery * q, QofQuerySort ** primary,
1441 QofQuerySort ** secondary, QofQuerySort ** tertiary)
1446 *primary = &(q->primary_sort);
1448 *secondary = &(q->secondary_sort);
1450 *tertiary = &(q->tertiary_sort);
1454 qof_query_sort_get_param_path (QofQuerySort * qs)
1458 return qs->param_list;
1462 qof_query_sort_get_sort_options (QofQuerySort * qs)
1470 qof_query_sort_get_increasing (QofQuerySort * qs)
1474 return qs->increasing;
1478 qof_query_term_equal (QofQueryTerm * qt1, QofQueryTerm * qt2)
1485 if (qt1->invert != qt2->invert)
1487 if (param_list_cmp (qt1->param_list, qt2->param_list))
1489 return qof_query_core_predicate_equal (qt1->pdata, qt2->pdata);
1493 qof_query_sort_equal (QofQuerySort * qs1, QofQuerySort * qs2)
1501 if (!qs1->param_list && !qs2->param_list)
1504 if (qs1->options != qs2->options)
1506 if (qs1->increasing != qs2->increasing)
1508 return (param_list_cmp (qs1->param_list, qs2->param_list) == 0);
1521 if (g_list_length (q1->terms) != g_list_length (q2->terms))
1523 if (q1->max_results != q2->max_results)
1526 for (or1 = q1->terms, or2 = q2->terms; or1;
1527 or1 = or1->next, or2 = or2->next)
1534 if (g_list_length (and1) != g_list_length (and2))
1537 for (; and1; and1 = and1->next, and2 = and2->next)
1538 if (!qof_query_term_equal (and1->data, and2->data))
1542 if (!qof_query_sort_equal (&(q1->primary_sort), &(q2->primary_sort)))
1544 if (!qof_query_sort_equal (&(q1->secondary_sort),
1545 &(q2->secondary_sort)))
1547 if (!qof_query_sort_equal (&(q1->tertiary_sort), &(q2->tertiary_sort)))
1558 static GList *qof_query_printSearchFor (
QofQuery * query, GList * output);
1559 static GList *qof_query_printTerms (
QofQuery * query, GList * output);
1560 static GList *qof_query_printSorts (QofQuerySort * s[],
1561 const gint numSorts, GList * output);
1562 static GList *qof_query_printAndTerms (GList * terms, GList * output);
1565 static gchar *qof_query_printDateMatch (
QofDateMatch d);
1567 static gchar *qof_query_printGuidMatch (
QofGuidMatch g);
1568 static gchar *qof_query_printCharMatch (
QofCharMatch c);
1569 static GList *qof_query_printPredData (
QofQueryPredData * pd, GList * lst);
1570 static GString *qof_query_printParamPath (GSList * parmList);
1573 static void qof_query_printOutput (GList * output);
1582 gint maxResults = 0, numSorts = 3;
1588 LEAVE (
"query is (null)");
1594 maxResults = qof_query_get_max_results (query);
1596 output = qof_query_printSearchFor (query, output);
1597 output = qof_query_printTerms (query, output);
1599 qof_query_get_sorts (query, &s[0], &s[1], &s[2]);
1603 output = qof_query_printSorts (s, numSorts, output);
1606 str = g_string_new (
" ");
1607 g_string_printf (str,
"Maximum number of results: %d", maxResults);
1608 output = g_list_append (output, str);
1610 qof_query_printOutput (output);
1615 qof_query_printOutput (GList * output)
1619 for (lst = output; lst; lst = lst->next)
1621 GString *line = (GString *) lst->data;
1623 DEBUG (
" %s", line->str);
1624 g_string_free (line, TRUE);
1634 qof_query_printSearchFor (
QofQuery * query, GList * output)
1640 gs = g_string_new (
"Query Object Type: ");
1641 g_string_append (gs, (NULL == searchFor) ?
"(null)" : searchFor);
1642 output = g_list_append (output, gs);
1653 qof_query_printTerms (
QofQuery * query, GList * output)
1658 terms = qof_query_get_terms (query);
1660 for (lst = terms; lst; lst = lst->next)
1663 g_list_append (output, g_string_new (
"OR Terms:"));
1667 output = qof_query_printAndTerms (lst->data, output);
1672 g_list_append (output,
1673 g_string_new (
" No data for AND terms"));
1686 qof_query_printSorts (QofQuerySort * s[],
const gint numSorts,
1689 GSList *gsl, *n = NULL;
1691 GString *gs = g_string_new (
"Sort Parameters: ");
1693 for (curSort = 0; curSort < numSorts; curSort++)
1695 gboolean increasing;
1700 increasing = qof_query_sort_get_increasing (s[curSort]);
1702 gsl = qof_query_sort_get_param_path (s[curSort]);
1704 g_string_append_printf (gs,
" Param: ");
1705 for (n = gsl; n; n = n->next)
1709 g_string_append_printf (gs,
" ");
1710 g_string_append_printf (gs,
"%s", param_name);
1714 g_string_append_printf (gs,
" %s ",
1715 increasing ?
"DESC" :
"ASC");
1716 g_string_append_printf (gs,
" Options: 0x%x ",
1717 s[curSort]->options);
1721 output = g_list_append (output, gs);
1731 qof_query_printAndTerms (GList * terms, GList * output)
1733 const gchar *prefix =
"AND Terms:";
1740 output = g_list_append (output, g_string_new (prefix));
1741 for (lst = terms; lst; lst = lst->next)
1743 qt = (QofQueryTerm *) lst->data;
1744 pd = qof_query_term_get_pred_data (qt);
1745 path = qof_query_term_get_param_path (qt);
1746 invert = qof_query_term_is_inverted (qt);
1750 g_list_append (output, g_string_new (
" INVERT SENSE "));
1751 output = g_list_append (output, qof_query_printParamPath (path));
1752 output = qof_query_printPredData (pd, output);
1763 qof_query_printParamPath (GSList * parmList)
1765 GSList *list = NULL;
1766 GString *gs = g_string_new (
"Param List: ");
1767 g_string_append (gs,
" ");
1768 for (list = parmList; list; list = list->next)
1770 g_string_append (gs, (gchar *) list->data);
1772 g_string_append (gs,
", ");
1786 gs = g_string_new (
"Pred Data: ");
1787 g_string_append (gs, (gchar *) pd->type_name);
1793 g_string_append_printf (gs,
" how: %s",
1794 qof_query_printStringForHow (pd->how));
1796 lst = g_list_append (lst, gs);
1797 gs = g_string_new (
"");
1798 qof_query_printValueForParam (pd, gs);
1799 lst = g_list_append (lst, gs);
1813 AS_STRING_CASE(QOF_COMPARE_LT,)
1814 AS_STRING_CASE(QOF_COMPARE_LTE,)
1815 AS_STRING_CASE(QOF_COMPARE_EQUAL,)
1816 AS_STRING_CASE(QOF_COMPARE_GT,)
1817 AS_STRING_CASE(QOF_COMPARE_GTE,)
1818 AS_STRING_CASE(QOF_COMPARE_NEQ,)
1820 return "INVALID HOW";
1832 g_string_append_printf (gs,
"Match type %s ",
1833 qof_query_printGuidMatch (pdata->options));
1834 for (node = pdata->guids; node; node = node->next)
1837 g_string_append_printf (gs,
", guids: %s",
1842 if (!
safe_strcmp (pd->type_name, QOF_TYPE_STRING))
1845 g_string_append_printf (gs,
"Match type %s ",
1846 qof_query_printStringMatch (pdata->options));
1847 g_string_append_printf (gs,
" %s string: %s",
1848 pdata->is_regex ?
"Regex" :
"Not regex", pdata->matchstring);
1851 if (!
safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC))
1854 g_string_append_printf (gs,
"Match type %s ",
1855 qof_query_printNumericMatch (pdata->options));
1856 g_string_append_printf (gs,
" numeric: %s",
1864 g_string_append_printf (gs,
" kvp path: ");
1865 for (node = pdata->path; node; node = node->next)
1867 g_string_append_printf (gs,
"/%s", (gchar *) node->data);
1869 g_string_append_printf (gs,
" kvp value: %s ",
1876 g_string_append_printf (gs,
" int64: %" G_GINT64_FORMAT,
1883 g_string_append_printf (gs,
" int32: %d", pdata->val);
1886 if (!
safe_strcmp (pd->type_name, QOF_TYPE_DOUBLE))
1889 g_string_append_printf (gs,
" double: %.18g", pdata->val);
1899 g_string_append_printf (gs,
"Match type %s " ,
1900 qof_query_printDateMatch (pdata->options));
1901 g_string_append_printf (gs,
"query date: %s",
1905 #ifndef QOF_DISABLE_DEPRECATED
1911 g_string_append_printf (gs,
"Match type %s ",
1912 qof_query_printDateMatch (pdata->options));
1913 g_string_append_printf (gs,
" query_date: %s",
1914 gnc_print_date (pdata->date));
1921 g_string_append_printf (gs,
"Match type %s ",
1922 qof_query_printCharMatch (pdata->options));
1923 g_string_append_printf (gs,
" char list: %s",
1927 if (!
safe_strcmp (pd->type_name, QOF_TYPE_BOOLEAN))
1930 g_string_append_printf (gs,
" boolean: %s",
1931 pdata->val ?
"TRUE" :
"FALSE");
1947 AS_STRING_CASE(QOF_STRING_MATCH_NORMAL,)
1948 AS_STRING_CASE(QOF_STRING_MATCH_CASEINSENSITIVE,)
1950 return "UNKNOWN MATCH TYPE";
1962 AS_STRING_CASE(QOF_DATE_MATCH_NORMAL,)
1963 AS_STRING_CASE(QOF_DATE_MATCH_DAY,)
1965 return "UNKNOWN MATCH TYPE";
1977 AS_STRING_CASE(QOF_NUMERIC_MATCH_DEBIT,)
1978 AS_STRING_CASE(QOF_NUMERIC_MATCH_CREDIT,)
1979 AS_STRING_CASE(QOF_NUMERIC_MATCH_ANY,)
1981 return "UNKNOWN MATCH TYPE";
1995 AS_STRING_CASE(QOF_GUID_MATCH_NONE,)
1996 AS_STRING_CASE(QOF_GUID_MATCH_NULL,)
2000 return "UNKNOWN MATCH TYPE";
2012 AS_STRING_CASE(QOF_CHAR_MATCH_ANY,)
2013 AS_STRING_CASE(QOF_CHAR_MATCH_NONE,)
2015 return "UNKNOWN MATCH TYPE";