r14902 - gnucash/trunk - Revert r14892 in order to try a different approach.

Derek Atkins warlord at cvs.gnucash.org
Wed Sep 27 09:30:41 EDT 2006


Author: warlord
Date: 2006-09-27 09:30:05 -0400 (Wed, 27 Sep 2006)
New Revision: 14902
Trac: http://svn.gnucash.org/trac/changeset/14902

Modified:
   gnucash/trunk/
   gnucash/trunk/ChangeLog
   gnucash/trunk/lib/libqof/qof/qofbookmerge.c
   gnucash/trunk/lib/libqof/qof/qofclass.c
   gnucash/trunk/lib/libqof/qof/qofclass.h
   gnucash/trunk/lib/libqof/qof/qofquery-deserial.c
   gnucash/trunk/lib/libqof/qof/qofquery-serialize.c
   gnucash/trunk/lib/libqof/qof/qofquery.c
   gnucash/trunk/lib/libqof/qof/qofquerycore.c
   gnucash/trunk/lib/libqof/qof/qofquerycore.h
   gnucash/trunk/lib/libqof/qof/qofsession.c
   gnucash/trunk/lib/libqof/qof/qofsql.c
   gnucash/trunk/lib/libqof/qof/qofutil.c
   gnucash/trunk/src/backend/postgres/gncquery.c
   gnucash/trunk/src/engine/Query.c
   gnucash/trunk/src/engine/Query.h
   gnucash/trunk/src/engine/Transaction.c
   gnucash/trunk/src/engine/engine-helpers.c
   gnucash/trunk/src/gnome-search/search-core-type.c
   gnucash/trunk/src/gnome-search/search-string.c
   gnucash/trunk/src/gnome-search/search-string.h
Log:
Revert r14892 in order to try a different approach.



Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:647
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13363
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:647
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13363
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13354

Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/ChangeLog	2006-09-27 13:30:05 UTC (rev 14902)
@@ -4,15 +4,6 @@
 	  Implement SubQuery functionality in QOF:  qof_query_run_subquery()
 	  Now you can run one query off of the results of another query.
 
-2006-09-25  Derek Atkins  <derek at ihtfp.com>
-
-	[ Lots of files ]:
-	  Add a new QOF_TYPE_NUMSTRING to add numeric sorts.  (#150799).
-	  This new type is like QOF_TYPE_STRING but it sorts numerically
-	  (first) and then sorts alphanumerically (by the tail of the
-	  number).  Added the QOF Type, the gnome-search support, and
-	  modified TRANS_NUM to use the new type.
-
 2006-09-23  Derek Atkins  <derek at ihtfp.com>
 
 	* src/ledger-core/split-register*.c:

Modified: gnucash/trunk/lib/libqof/qof/qofbookmerge.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofbookmerge.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofbookmerge.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -126,8 +126,7 @@
 		mergeParamName = qtparam->param_name;
 		g_return_val_if_fail(mergeParamName != NULL, -1);
 		mergeType = qtparam->param_type;
-		if(safe_strcmp(mergeType, QOF_TYPE_STRING) == 0 ||
-		   safe_strcmp(mergeType, QOF_TYPE_NUMSTRING) == 0)  { 
+		if(safe_strcmp(mergeType, QOF_TYPE_STRING) == 0)  { 
 			stringImport = qtparam->param_getfcn(mergeEnt,qtparam);
 			stringTarget = qtparam->param_getfcn(targetEnt,qtparam);
 			/* very strict string matches may need to be relaxed. */
@@ -644,8 +643,7 @@
 		g_return_if_fail(rule->mergeParam->data);
 		cm_param = rule->mergeParam->data;
 		rule->mergeType = cm_param->param_type;
-		if(safe_strcmp(rule->mergeType, QOF_TYPE_STRING) == 0 ||
-		   safe_strcmp(rule->mergeType, QOF_TYPE_NUMSTRING) == 0)  { 
+		if(safe_strcmp(rule->mergeType, QOF_TYPE_STRING) == 0)  { 
 			cm_string = cm_param->param_getfcn(rule->importEnt, cm_param);
 			string_setter = (void(*)(QofEntity*, const gchar*))cm_param->param_setfcn;
 			if(string_setter != NULL) { string_setter(rule->targetEnt, cm_string); }
@@ -838,8 +836,7 @@
 
 	param_string = NULL;
 	paramType = qtparam->param_type;
-	if(safe_strcmp(paramType, QOF_TYPE_STRING) == 0 ||
-	   safe_strcmp(paramType, QOF_TYPE_NUMSTRING) == 0)  { 
+	if(safe_strcmp(paramType, QOF_TYPE_STRING) == 0)  { 
 			param_string = g_strdup(qtparam->param_getfcn(qtEnt,qtparam));
 			if(param_string == NULL) { param_string = ""; }
 			return param_string;

Modified: gnucash/trunk/lib/libqof/qof/qofclass.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofclass.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofclass.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -274,7 +274,6 @@
 	b = (struct param_ref_list*)user_data;
 	if((param->param_getfcn == NULL)||(param->param_setfcn == NULL)) { return; }
 	if(0 == safe_strcmp(param->param_type, QOF_TYPE_STRING)) { return; }
-	if(0 == safe_strcmp(param->param_type, QOF_TYPE_NUMSTRING)) { return; }
 	if(0 == safe_strcmp(param->param_type, QOF_TYPE_NUMERIC)) { return; }
 	if(0 == safe_strcmp(param->param_type, QOF_TYPE_DATE)) { return; }
 	if(0 == safe_strcmp(param->param_type, QOF_TYPE_CHAR)) { return; }

Modified: gnucash/trunk/lib/libqof/qof/qofclass.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofclass.h	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofclass.h	2006-09-27 13:30:05 UTC (rev 14902)
@@ -83,8 +83,6 @@
  */
 
 #define QOF_TYPE_STRING    "string"
-#define QOF_TYPE_NUMSTRING "numstring" /**< a string that sorts in numeric
-					  order instead of typological order */
 #define QOF_TYPE_DATE      "date"
 #define QOF_TYPE_NUMERIC   "numeric"
 #define QOF_TYPE_DEBCRED   "debcred"

Modified: gnucash/trunk/lib/libqof/qof/qofquery-deserial.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquery-deserial.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofquery-deserial.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -694,7 +694,6 @@
 		{ "aflt", QOF_TYPE_DOUBLE, NULL, NULL},
 		{ "abool", QOF_TYPE_BOOLEAN, NULL, NULL},
 		{ "astr", QOF_TYPE_STRING, NULL, NULL},
-		{ "nstr", QOF_TYPE_NUMSTRING, NULL, NULL},
 		{ "adate", QOF_TYPE_DATE, NULL, NULL},
 		{ "anum", QOF_TYPE_NUMERIC, NULL, NULL},
 		{ "achar", QOF_TYPE_CHAR, NULL, NULL},

Modified: gnucash/trunk/lib/libqof/qof/qofquery-serialize.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquery-serialize.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofquery-serialize.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -240,8 +240,7 @@
 		}
 		return topnode;
 	}
-	if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING) ||
-	    !safe_strcmp (pd->type_name, QOF_TYPE_NUMSTRING))
+	if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING))
 	{
 		topnode = xmlNewNode (NULL, "qofquery:pred-string");
 		PUT_HOW ("qofquery:compare", pd->how, LT, LTE, EQUAL, GT, GTE, NEQ);
@@ -556,7 +555,6 @@
 		{ "aint",   QOF_TYPE_INT32, NULL, NULL},
 		{ "aint64", QOF_TYPE_INT64, NULL, NULL},
 		{ "astr",   QOF_TYPE_STRING, NULL, NULL},
-		{ "nstr",   QOF_TYPE_NUMSTRING, NULL, NULL},
 		{ NULL },
 	};
 

Modified: gnucash/trunk/lib/libqof/qof/qofquery.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquery.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofquery.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -1738,8 +1738,7 @@
     }
     return;
   }
-  if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING) ||
-      !safe_strcmp (pd->type_name, QOF_TYPE_NUMSTRING))
+  if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING))
   {
     query_string_t pdata = (query_string_t) pd;
     g_string_append_printf (gs, " Match type %s",

Modified: gnucash/trunk/lib/libqof/qof/qofquerycore.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquerycore.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofquerycore.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -24,7 +24,6 @@
 #include "config.h"
 
 #include <glib.h>
-#include <stdlib.h>
 
 #include "qof.h"
 #include "qofquerycore-p.h"
@@ -55,7 +54,6 @@
 /* Core Type Predicate helpers */
 typedef const char * (*query_string_getter) (gpointer, QofParam *);
 static const char * query_string_type = QOF_TYPE_STRING;
-static const char * query_numstring_type = QOF_TYPE_NUMSTRING;
 
 typedef Timespec (*query_date_getter) (gpointer, QofParam *);
 static const char * query_date_type = QOF_TYPE_DATE;
@@ -126,17 +124,19 @@
 /* *******************************************************************/
 /* TYPE-HANDLING FUNCTIONS */
 
-/* QOF_TYPE_STRING and QOF_TYPE_NUMSTRING / common functions */
+/* QOF_TYPE_STRING */
 
 static int
-string_match_predicate_common (gpointer object,
-			       QofParam *getter,
-			       QofQueryPredData *pd)
+string_match_predicate (gpointer object,
+                        QofParam *getter,
+                        QofQueryPredData *pd)
 {
   query_string_t pdata = (query_string_t) pd;
   const char *s;
   int ret = 0;
 
+  VERIFY_PREDICATE (query_string_type);
+
   s = ((query_string_getter)getter->param_getfcn) (object, getter);
 
   if (!s) s = "";
@@ -166,11 +166,29 @@
   }
 }
 
+static int
+string_compare_func (gpointer a, gpointer b, gint options,
+                     QofParam *getter)
+{
+  const char *s1, *s2;
+  g_return_val_if_fail (a && b && getter &&getter->param_getfcn, COMPARE_ERROR);
+
+  s1 = ((query_string_getter)getter->param_getfcn) (a, getter);
+  s2 = ((query_string_getter)getter->param_getfcn) (b, getter);
+
+  if (options == QOF_STRING_MATCH_CASEINSENSITIVE)
+    return safe_strcasecmp (s1, s2);
+
+  return safe_strcmp (s1, s2);
+}
+
 static void
-string_free_pdata_common (QofQueryPredData *pd)
+string_free_pdata (QofQueryPredData *pd)
 {
   query_string_t pdata = (query_string_t) pd;
 
+  VERIFY_PDATA (query_string_type);
+
   if (pdata->is_regex)
     regfree (&pdata->compiled);
   else
@@ -180,11 +198,33 @@
 }
 
 static QofQueryPredData *
-qof_query_string_predicate_common (QofQueryCompare how,
-				   const char *str, QofStringMatch options,
-				   gboolean is_regex,
-				   const char* type)
+string_copy_predicate (QofQueryPredData *pd)
 {
+  query_string_t pdata = (query_string_t) pd;
+
+  VERIFY_PDATA_R (query_string_type);
+
+  return qof_query_string_predicate (pd->how, pdata->matchstring,
+                                     pdata->options,
+                                     pdata->is_regex);
+}
+
+static gboolean
+string_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
+{
+  query_string_t pd1 = (query_string_t) p1;
+  query_string_t pd2 = (query_string_t) p2;
+
+  if (pd1->options != pd2->options) return FALSE;
+  if (pd1->is_regex != pd2->is_regex) return FALSE;
+  return (safe_strcmp (pd1->matchstring, pd2->matchstring) == 0);
+}
+
+QofQueryPredData *
+qof_query_string_predicate (QofQueryCompare how,
+                            const char *str, QofStringMatch options,
+                            gboolean is_regex)
+{
   query_string_t pdata;
 
   g_return_val_if_fail (str, NULL);
@@ -192,7 +232,7 @@
   g_return_val_if_fail (how == QOF_COMPARE_EQUAL || how == QOF_COMPARE_NEQ, NULL);
 
   pdata = g_new0 (query_string_def, 1);
-  pdata->pd.type_name = type;
+  pdata->pd.type_name = query_string_type;
   pdata->pd.how = how;
   pdata->options = options;
   pdata->matchstring = g_strdup (str);
@@ -209,17 +249,6 @@
   return ((QofQueryPredData*)pdata);
 }
 
-static gboolean
-string_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
-{
-  query_string_t pd1 = (query_string_t) p1;
-  query_string_t pd2 = (query_string_t) p2;
-
-  if (pd1->options != pd2->options) return FALSE;
-  if (pd1->is_regex != pd2->is_regex) return FALSE;
-  return (safe_strcmp (pd1->matchstring, pd2->matchstring) == 0);
-}
-
 static char *
 string_to_string (gpointer object, QofParam *getter)
 {
@@ -230,132 +259,6 @@
   return NULL;
 }
 
-/* QOF_QUERY_STRING */
-
-static int
-string_match_predicate (gpointer object,
-                        QofParam *getter,
-                        QofQueryPredData *pd)
-{
-  VERIFY_PREDICATE (query_string_type);
-  return string_match_predicate_common(object, getter, pd);
-}
-
-static int
-string_compare_func (gpointer a, gpointer b, gint options,
-                     QofParam *getter)
-{
-  const char *s1, *s2;
-  g_return_val_if_fail (a && b && getter &&getter->param_getfcn, COMPARE_ERROR);
-
-  s1 = ((query_string_getter)getter->param_getfcn) (a, getter);
-  s2 = ((query_string_getter)getter->param_getfcn) (b, getter);
-
-  if (options == QOF_STRING_MATCH_CASEINSENSITIVE)
-    return safe_strcasecmp (s1, s2);
-
-  return safe_strcmp (s1, s2);
-}
-
-static void
-string_free_pdata (QofQueryPredData *pd)
-{
-  VERIFY_PDATA (query_string_type);
-  return string_free_pdata_common(pd);
-}
-
-static QofQueryPredData *
-string_copy_predicate (QofQueryPredData *pd)
-{
-  query_string_t pdata = (query_string_t) pd;
-
-  VERIFY_PDATA_R (query_string_type);
-
-  return qof_query_string_predicate_common (pd->how, pdata->matchstring,
-					    pdata->options,
-					    pdata->is_regex,
-					    query_string_type);
-}
-
-QofQueryPredData *
-qof_query_string_predicate (QofQueryCompare how,
-                            const char *str, QofStringMatch options,
-                            gboolean is_regex)
-{
-  return qof_query_string_predicate_common(how, str, options, is_regex,
-					   query_string_type);
-}
-
-/* QOF_QUERY_NUMSTRING */
-
-static int
-numstring_match_predicate (gpointer object,
-                        QofParam *getter,
-                        QofQueryPredData *pd)
-{
-  VERIFY_PREDICATE (query_numstring_type);
-  return string_match_predicate_common(object, getter, pd);
-}
-
-static int
-numstring_compare_func (gpointer a, gpointer b, gint options,
-                     QofParam *getter)
-{
-  const char *s1, *s2;
-  char *sr1, *sr2;
-  long i1, i2;
-  g_return_val_if_fail (a && b && getter &&getter->param_getfcn, COMPARE_ERROR);
-
-  s1 = ((query_string_getter)getter->param_getfcn) (a, getter);
-  s2 = ((query_string_getter)getter->param_getfcn) (b, getter);
-
-  // Deal with NULL strings
-  if (s1 == s2)  return 0;
-  if (!s1 && s2) return -1;
-  if (s1 && !s2) return 1;
-
-  // Convert to integers and test
-  i1 = strtol(s1, &sr1, 0);
-  i2 = strtol(s2, &sr2, 0);
-  if (i1 < i2)  return -1;
-  if (i1 > i2)  return 1;
-
-  // If the integers match, then test the REST of the string as text.
-  if (options == QOF_STRING_MATCH_CASEINSENSITIVE)
-    return safe_strcasecmp (sr1, sr2);
-
-  return safe_strcmp (sr1, sr2);
-}
-
-static void
-numstring_free_pdata (QofQueryPredData *pd)
-{
-  VERIFY_PDATA (query_numstring_type);
-  return string_free_pdata_common(pd);
-}
-
-static QofQueryPredData *
-numstring_copy_predicate (QofQueryPredData *pd)
-{
-  query_string_t pdata = (query_string_t) pd;
-
-  VERIFY_PDATA_R (query_numstring_type);
-
-  return qof_query_string_predicate_common (pd->how, pdata->matchstring,
-					    pdata->options,
-					    pdata->is_regex,
-					    query_numstring_type);
-}
-
-QofQueryPredData *
-qof_query_numstring_predicate (QofQueryCompare how,
-                            const char *str, QofStringMatch options,
-                            gboolean is_regex)
-{
-  return qof_query_string_predicate_common(how, str, options, is_regex,
-					   query_numstring_type);
-}
-
 /* QOF_TYPE_DATE =================================================== */
 
 static int
@@ -1758,9 +1661,6 @@
     { QOF_TYPE_STRING, string_match_predicate, string_compare_func,
       string_copy_predicate, string_free_pdata, string_to_string,
       string_predicate_equal },
-    { QOF_TYPE_NUMSTRING, numstring_match_predicate, numstring_compare_func,
-      numstring_copy_predicate, numstring_free_pdata, string_to_string,
-      string_predicate_equal },
     { QOF_TYPE_DATE, date_match_predicate, date_compare_func,
       date_copy_predicate, date_free_pdata, date_to_string,
       date_predicate_equal },

Modified: gnucash/trunk/lib/libqof/qof/qofquerycore.h
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquerycore.h	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofquerycore.h	2006-09-27 13:30:05 UTC (rev 14902)
@@ -141,11 +141,6 @@
                                               QofStringMatch options,
                                               gboolean is_regex);
 
-QofQueryPredData *qof_query_numstring_predicate (QofQueryCompare how,
-						 const gchar *str,
-						 QofStringMatch options,
-						 gboolean is_regex);
-
 QofQueryPredData *qof_query_date_predicate (QofQueryCompare how,
                                             QofDateMatch options,
                                             Timespec date);

Modified: gnucash/trunk/lib/libqof/qof/qofsession.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofsession.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofsession.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -426,8 +426,7 @@
 	cm_param = (QofParam*) data;
 	g_return_if_fail(cm_param != NULL);
 	context->param = cm_param;
-	if(safe_strcmp(cm_param->param_type, QOF_TYPE_STRING) == 0 ||
-	   safe_strcmp(cm_param->param_type, QOF_TYPE_NUMSTRING) == 0)  { 
+	if(safe_strcmp(cm_param->param_type, QOF_TYPE_STRING) == 0)  { 
 		cm_string = (gchar*)cm_param->param_getfcn(importEnt, cm_param);
 		if(cm_string) {
 		string_setter = (void(*)(QofEntity*, const char*))cm_param->param_setfcn;

Modified: gnucash/trunk/lib/libqof/qof/qofsql.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofsql.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofsql.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -308,8 +308,7 @@
 		return NULL;
 	}
 
-	if (!strcmp (param_type, QOF_TYPE_STRING) ||
-	    !strcmp (param_type, QOF_TYPE_NUMSTRING))
+	if (!strcmp (param_type, QOF_TYPE_STRING))
 	{
 		pred_data = 
 		    qof_query_string_predicate (qop,        /* comparison to make */
@@ -606,8 +605,7 @@
 
 	ENTER (" param=%s param_type=%s type=%s content=%s", 
 		param->param_name, param->param_type, type, insert_string);
-	if(safe_strcmp(param->param_type, QOF_TYPE_STRING) == 0 ||
-	   safe_strcmp(param->param_type, QOF_TYPE_NUMSTRING) == 0)  { 
+	if(safe_strcmp(param->param_type, QOF_TYPE_STRING) == 0)  { 
 		string_setter = (void(*)(QofEntity*, const char*))param->param_setfcn;
 		if(string_setter != NULL) { string_setter(ent, insert_string); }
 		registered_type = TRUE;

Modified: gnucash/trunk/lib/libqof/qof/qofutil.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofutil.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/lib/libqof/qof/qofutil.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -416,8 +416,7 @@
 	param_string = NULL;
     known_type = FALSE;
 	paramType = param->param_type;
-	if(safe_strcmp(paramType, QOF_TYPE_STRING) == 0 ||
-	   safe_strcmp(paramType, QOF_TYPE_NUMSTRING) == 0)  { 
+	if(safe_strcmp(paramType, QOF_TYPE_STRING) == 0)  { 
 			param_string = g_strdup(param->param_getfcn(ent, param));
 			if(param_string == NULL) { param_string = ""; }
             known_type = TRUE;

Modified: gnucash/trunk/src/backend/postgres/gncquery.c
===================================================================
--- gnucash/trunk/src/backend/postgres/gncquery.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/backend/postgres/gncquery.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -958,8 +958,7 @@
                     more_and = 0;
                 }
 
-            } else if (!safe_strcmp(pd->type_name, QOF_TYPE_STRING) ||
-		       !safe_strcmp(pd->type_name, QOF_TYPE_NUMSTRING)) {
+            } else if (!safe_strcmp(pd->type_name, QOF_TYPE_STRING)) {
                 query_string_t pdata = (query_string_t) pd;
 
                 if (!safe_strcmp(path->data, SPLIT_ACTION)) {

Modified: gnucash/trunk/src/engine/Query.c
===================================================================
--- gnucash/trunk/src/engine/Query.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/engine/Query.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -320,32 +320,6 @@
 }
 
 void
-xaccQueryAddNumStringMatch (Query* q, const char *matchstring,
-			    int case_sens, int use_regexp, QofQueryOp op,
-			    const char * path, ...)
-{
-  QofQueryPredData *pred_data;
-  GSList *param_list;
-  va_list ap;
-
-  if (!path || !q)
-    return;
-
-  pred_data = qof_query_numstring_predicate (QOF_COMPARE_EQUAL, (char *)matchstring,
-				       (case_sens ? QOF_STRING_MATCH_NORMAL :
-					QOF_STRING_MATCH_CASEINSENSITIVE),
-				       use_regexp);
-  if (!pred_data)
-    return;
-
-  va_start (ap, path);
-  param_list = build_param_list_internal (path, ap);
-  va_end (ap);
-
-  qof_query_add_term (q, param_list, pred_data, op);
-}
-
-void
 xaccQueryAddNumericMatch (Query *q, gnc_numeric amount, QofNumericMatch sign,
 			  QofQueryCompare how, QofQueryOp op,
 			  const char * path, ...)

Modified: gnucash/trunk/src/engine/Query.h
===================================================================
--- gnucash/trunk/src/engine/Query.h	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/engine/Query.h	2006-09-27 13:30:05 UTC (rev 14902)
@@ -127,15 +127,11 @@
 			      int case_sens, int use_regexp, QofQueryOp op,
 			      const char * path, ...);
 
-void xaccQueryAddNumStringMatch (Query* q, const char *matchstring,
-			      int case_sens, int use_regexp, QofQueryOp op,
-			      const char * path, ...);
-
 #define xaccQueryAddDescriptionMatch(q,m,c,r,o) \
 	xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS, \
 				TRANS_DESCRIPTION, NULL)
 #define xaccQueryAddNumberMatch(q,m,c,r,o) \
-	xaccQueryAddNumStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS, \
+	xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS, \
 				TRANS_NUM, NULL)
 #define xaccQueryAddActionMatch(q,m,c,r,o) \
 	xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_ACTION, \

Modified: gnucash/trunk/src/engine/Transaction.c
===================================================================
--- gnucash/trunk/src/engine/Transaction.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/engine/Transaction.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -1966,7 +1966,7 @@
 gboolean xaccTransRegister (void)
 {
   static QofParam params[] = {
-    { TRANS_NUM, QOF_TYPE_NUMSTRING, 
+    { TRANS_NUM, QOF_TYPE_STRING, 
       (QofAccessFunc)xaccTransGetNum, 
       (QofSetterFunc)qofTransSetNum },
     { TRANS_DESCRIPTION, QOF_TYPE_STRING, 

Modified: gnucash/trunk/src/engine/engine-helpers.c
===================================================================
--- gnucash/trunk/src/engine/engine-helpers.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/engine/engine-helpers.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -864,8 +864,7 @@
   qt_scm = scm_cons (scm_str2symbol (pd->type_name), qt_scm);
   qt_scm = scm_cons (gnc_query_compare2scm (pd->how), qt_scm);
 
-  if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING) ||
-      !safe_strcmp (pd->type_name, QOF_TYPE_NUMSTRING)) {
+  if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING)) {
     query_string_t pdata = (query_string_t) pd;
 
     qt_scm = scm_cons (gnc_query_string2scm (pdata->options), qt_scm);
@@ -970,8 +969,7 @@
 
     /* Now compute the predicate */
 
-    if (!safe_strcmp (type, QOF_TYPE_STRING) ||
-	!safe_strcmp (type, QOF_TYPE_NUMSTRING))
+    if (!safe_strcmp (type, QOF_TYPE_STRING)) 
     {
       QofStringMatch options;
       gboolean is_regex;
@@ -993,12 +991,8 @@
 
       matchstring = SCM_STRING_CHARS (scm);
 
-      if (!safe_strcmp (type, QOF_TYPE_STRING))
-	pd = qof_query_string_predicate (compare_how, matchstring,
-					 options, is_regex);
-      else
-	pd = qof_query_numstring_predicate (compare_how, matchstring,
-					    options, is_regex);
+      pd = qof_query_string_predicate (compare_how, matchstring,
+                                    options, is_regex);
     } 
     else if (!safe_strcmp (type, QOF_TYPE_DATE)) 
     {

Modified: gnucash/trunk/src/gnome-search/search-core-type.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-core-type.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/gnome-search/search-core-type.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -255,8 +255,6 @@
 {
   gnc_search_core_register_type (QUERYCORE_STRING,
 				 (GNCSearchCoreNew) gnc_search_string_new);
-  gnc_search_core_register_type (QOF_TYPE_NUMSTRING,
-				 (GNCSearchCoreNew) gnc_search_string_new_numstring);
   gnc_search_core_register_type (QUERYCORE_DATE,
 				 (GNCSearchCoreNew) gnc_search_date_new);
   gnc_search_core_register_type (QUERYCORE_INT64,

Modified: gnucash/trunk/src/gnome-search/search-string.c
===================================================================
--- gnucash/trunk/src/gnome-search/search-string.c	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/gnome-search/search-string.c	2006-09-27 13:30:05 UTC (rev 14902)
@@ -112,7 +112,6 @@
   o->value = NULL;
   o->how = SEARCH_STRING_CONTAINS;
   o->ign_case = TRUE;
-  o->is_numstring = FALSE;
 }
 
 static void
@@ -140,21 +139,6 @@
   return o;
 }
 
-/**
- * gnc_search_string_new_numstring:
- *
- * Create a new GNCSearchString object for a NumString.
- * 
- * Return value: A new #GNCSearchString object.
- **/
-GNCSearchString *
-gnc_search_string_new_numstring (void)
-{
-  GNCSearchString *o = g_object_new(GNC_TYPE_SEARCH_STRING, NULL);
-  o->is_numstring = TRUE;
-  return o;
-}
-
 void
 gnc_search_string_set_value (GNCSearchString *fi, const char *value)
 {
@@ -375,10 +359,7 @@
   if (ss->ign_case)
     options = STRING_MATCH_CASEINSENSITIVE;
 
-  if (ss->is_numstring)
-    return qof_query_numstring_predicate (how, ss->value, options, is_regex);
-  else
-    return gncQueryStringPredicate (how, ss->value, options, is_regex);
+  return gncQueryStringPredicate (how, ss->value, options, is_regex);
 }
 
 static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
@@ -388,10 +369,7 @@
   g_return_val_if_fail (fse, NULL);
   g_return_val_if_fail (IS_GNCSEARCH_STRING (fse), NULL);
 
-  if (fse->is_numstring)
-    se = gnc_search_string_new_numstring ();
-  else
-    se = gnc_search_string_new ();
+  se = gnc_search_string_new ();
   gnc_search_string_set_value (se, fse->value);
   gnc_search_string_set_how (se, fse->how);
   gnc_search_string_set_case (se, fse->ign_case);

Modified: gnucash/trunk/src/gnome-search/search-string.h
===================================================================
--- gnucash/trunk/src/gnome-search/search-string.h	2006-09-26 23:47:09 UTC (rev 14901)
+++ gnucash/trunk/src/gnome-search/search-string.h	2006-09-27 13:30:05 UTC (rev 14902)
@@ -44,9 +44,6 @@
   GNCSearchString_Type	how;
   gboolean		ign_case;
   char *		value;
-
-  /* Is this is String or a NumString */
-  gboolean		is_numstring;
 };
 
 struct _GNCSearchStringClass {
@@ -59,7 +56,6 @@
 
 guint		gnc_search_string_get_type	(void);
 GNCSearchString	*gnc_search_string_new	(void);
-GNCSearchString	*gnc_search_string_new_numstring(void);
 
 /* methods */
 void	gnc_search_string_set_value(GNCSearchString *fi, const char *value);



More information about the gnucash-changes mailing list