diff options
author | Chris Toshok <toshok@ximian.com> | 2001-07-26 02:58:47 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-07-26 02:58:47 +0800 |
commit | 2061924fd02b4e7f3bed5d444d41b616f268d916 (patch) | |
tree | d4d40016cd9107e3a265132b8d645b8d70f09f2b | |
parent | 5faad755894f3fc316b58027c29695f78ceba134 (diff) | |
download | gsoc2013-evolution-2061924fd02b4e7f3bed5d444d41b616f268d916.tar.gz gsoc2013-evolution-2061924fd02b4e7f3bed5d444d41b616f268d916.tar.zst gsoc2013-evolution-2061924fd02b4e7f3bed5d444d41b616f268d916.zip |
change the way x-evolution-any-field is converted to an ldap query. it
2001-07-25 Chris Toshok <toshok@ximian.com>
* backend/pas/pas-backend-ldap.c (func_contains): change the way
x-evolution-any-field is converted to an ldap query. it used to
be we'd nest queries like: (|(|(|(foo=*x*))(bar=*x*))(baz=*x*)).
now we build it like: (|(foo=*x*)(bar=*x*)(baz=*x*)). much more
efficient (both in the building, and on the server side no doubt).
svn path=/trunk/; revision=11407
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-ldap.c | 18 |
2 files changed, 12 insertions, 14 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index d7f2827dd3..252425b7bf 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2001-07-25 Chris Toshok <toshok@ximian.com> + + * backend/pas/pas-backend-ldap.c (func_contains): change the way + x-evolution-any-field is converted to an ldap query. it used to + be we'd nest queries like: (|(|(|(foo=*x*))(bar=*x*))(baz=*x*)). + now we build it like: (|(foo=*x*)(bar=*x*)(baz=*x*)). much more + efficient (both in the building, and on the server side no doubt). + 2001-07-25 Jon Trowbridge <trow@ximian.com> * backend/ebook/e-destination.c (e_destination_get_name): Properly dup diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 056e56f28f..f4d0fc78a9 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -1539,39 +1539,29 @@ func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data int i; int query_length; char *big_query; - char *header, *footer; char *match_str; - header = g_malloc0((num_prop_infos - 1) * 2 + 1); - footer = g_malloc0(num_prop_infos + 1); - for (i = 0; i < num_prop_infos - 1; i ++) { - strcat (header, "(|"); - strcat (footer, ")"); - } - match_str = g_strdup_printf("=*%s%s)", str, one_star ? "" : "*"); - query_length = strlen (header) + strlen (footer); + query_length = 3; /* strlen ("(|") + strlen (")") */ for (i = 0; i < num_prop_infos; i ++) { - query_length += 1 + strlen(prop_info[i].ldap_attr) + strlen (match_str); + query_length += 1 /* strlen ("(") */ + strlen(prop_info[i].ldap_attr) + strlen (match_str); } big_query = g_malloc0(query_length + 1); - strcat (big_query, header); + strcat (big_query, "(|"); for (i = 0; i < num_prop_infos; i ++) { strcat (big_query, "("); strcat (big_query, prop_info[i].ldap_attr); strcat (big_query, match_str); } - strcat (big_query, footer); + strcat (big_query, ")"); *list = g_list_prepend(*list, big_query); g_free (match_str); - g_free (header); - g_free (footer); } else { char *ldap_attr = query_prop_to_ldap(propname); |