mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
add debug statements
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8868 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ed714f2aa5
commit
ce363e1b91
@ -360,6 +360,7 @@ check_object (QofQuery *q, gpointer object)
|
|||||||
QofQueryTerm * qt;
|
QofQueryTerm * qt;
|
||||||
int and_terms_ok=1;
|
int and_terms_ok=1;
|
||||||
|
|
||||||
|
ENTER (" object=%p terms=%p\n", object, q->terms);
|
||||||
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;
|
||||||
@ -422,6 +423,7 @@ static GSList * compile_params (GSList *param_list, QofIdType start_obj,
|
|||||||
const QofQueryObject *objDef = NULL;
|
const QofQueryObject *objDef = NULL;
|
||||||
GSList *fcns = NULL;
|
GSList *fcns = NULL;
|
||||||
|
|
||||||
|
ENTER (" ");
|
||||||
g_return_val_if_fail (param_list, NULL);
|
g_return_val_if_fail (param_list, NULL);
|
||||||
g_return_val_if_fail (start_obj, NULL);
|
g_return_val_if_fail (start_obj, NULL);
|
||||||
g_return_val_if_fail (final, NULL);
|
g_return_val_if_fail (final, NULL);
|
||||||
@ -444,6 +446,7 @@ static GSList * compile_params (GSList *param_list, QofIdType start_obj,
|
|||||||
start_obj = (QofIdType) objDef->param_type;
|
start_obj = (QofIdType) objDef->param_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LEAVE (" ");
|
||||||
return (g_slist_reverse (fcns));
|
return (g_slist_reverse (fcns));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,6 +487,7 @@ static void compile_terms (QofQuery *q)
|
|||||||
{
|
{
|
||||||
GList *or_ptr, *and_ptr, *node;
|
GList *or_ptr, *and_ptr, *node;
|
||||||
|
|
||||||
|
ENTER (" query=%p", q);
|
||||||
/* Find the specific functions for this Query. Note that the
|
/* Find the specific functions for this Query. Note that the
|
||||||
* Query's search_for should now be set to the new type.
|
* Query's search_for should now be set to the new type.
|
||||||
*/
|
*/
|
||||||
@ -528,6 +532,7 @@ static void compile_terms (QofQuery *q)
|
|||||||
g_hash_table_insert (q->be_compiled, book, result);
|
g_hash_table_insert (q->be_compiled, book, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LEAVE (" query=%p", q);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_item_cb (gpointer object, gpointer user_data)
|
static void check_item_cb (gpointer object, gpointer user_data)
|
||||||
@ -679,20 +684,21 @@ GList * qof_query_run (QofQuery *q)
|
|||||||
GList *node;
|
GList *node;
|
||||||
int object_count = 0;
|
int object_count = 0;
|
||||||
|
|
||||||
|
ENTER (" q=%p", q);
|
||||||
if (!q) return NULL;
|
if (!q) return NULL;
|
||||||
g_return_val_if_fail (q->search_for, NULL);
|
g_return_val_if_fail (q->search_for, NULL);
|
||||||
|
|
||||||
/* XXX: Prioritize the query terms? */
|
/* XXX: Prioritize the query terms? */
|
||||||
|
|
||||||
/* prepare the Query for processing */
|
/* prepare the Query for processing */
|
||||||
if (q->changed) {
|
if (q->changed)
|
||||||
|
{
|
||||||
query_clear_compiles (q);
|
query_clear_compiles (q);
|
||||||
compile_terms (q);
|
compile_terms (q);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Maybe log this sucker */
|
/* Maybe log this sucker */
|
||||||
if (gnc_should_log (module, GNC_LOG_DETAIL))
|
if (gnc_should_log (module, GNC_LOG_DETAIL)) qof_query_print (q);
|
||||||
qof_query_print (q);
|
|
||||||
|
|
||||||
/* Now run the query over all the objects and save the results */
|
/* Now run the query over all the objects and save the results */
|
||||||
{
|
{
|
||||||
@ -702,17 +708,21 @@ GList * qof_query_run (QofQuery *q)
|
|||||||
qcb.query = q;
|
qcb.query = q;
|
||||||
|
|
||||||
/* For each book */
|
/* For each book */
|
||||||
for (node=q->books; node; node=node->next) {
|
for (node=q->books; node; node=node->next)
|
||||||
|
{
|
||||||
QofBook *book = node->data;
|
QofBook *book = node->data;
|
||||||
QofBackend *be = book->backend;
|
QofBackend *be = book->backend;
|
||||||
|
|
||||||
/* run the query in the backend */
|
/* run the query in the backend */
|
||||||
if (be) {
|
if (be)
|
||||||
|
{
|
||||||
gpointer compiled_query = g_hash_table_lookup (q->be_compiled, book);
|
gpointer compiled_query = g_hash_table_lookup (q->be_compiled, book);
|
||||||
|
|
||||||
if (compiled_query && be->run_query)
|
if (compiled_query && be->run_query)
|
||||||
|
{
|
||||||
(be->run_query) (be, compiled_query);
|
(be->run_query) (be, compiled_query);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* and then iterate over all the objects */
|
/* and then iterate over all the objects */
|
||||||
qof_object_foreach (q->search_for, book, check_item_cb, &qcb);
|
qof_object_foreach (q->search_for, book, check_item_cb, &qcb);
|
||||||
@ -721,6 +731,7 @@ GList * qof_query_run (QofQuery *q)
|
|||||||
matching_objects = qcb.list;
|
matching_objects = qcb.list;
|
||||||
object_count = qcb.count;
|
object_count = qcb.count;
|
||||||
}
|
}
|
||||||
|
PINFO ("matching objects=%p count=%d", matching_objects, object_count);
|
||||||
|
|
||||||
/* There is no absolute need to reverse this list, since it's being
|
/* There is no absolute need to reverse this list, since it's being
|
||||||
* sorted below. However, in the common case, we will be searching
|
* sorted below. However, in the common case, we will be searching
|
||||||
@ -730,9 +741,9 @@ GList * qof_query_run (QofQuery *q)
|
|||||||
*/
|
*/
|
||||||
matching_objects = g_list_reverse(matching_objects);
|
matching_objects = g_list_reverse(matching_objects);
|
||||||
|
|
||||||
/* now sort the matching objects based on the search criteria
|
/* Now sort the matching objects based on the search criteria
|
||||||
* sortQuery is an unforgivable use of static global data... I just
|
* sortQuery is an unforgivable use of static global data...
|
||||||
* can't figure out how else to do this sanely.
|
* I just can't figure out how else to do this sanely.
|
||||||
*/
|
*/
|
||||||
sortQuery = q;
|
sortQuery = q;
|
||||||
matching_objects = g_list_sort(matching_objects, sort_func);
|
matching_objects = g_list_sort(matching_objects, sort_func);
|
||||||
@ -770,6 +781,7 @@ GList * qof_query_run (QofQuery *q)
|
|||||||
g_list_free(q->results);
|
g_list_free(q->results);
|
||||||
q->results = matching_objects;
|
q->results = matching_objects;
|
||||||
|
|
||||||
|
LEAVE (" q=%p", q);
|
||||||
return matching_objects;
|
return matching_objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user