After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 309276 - "is" sexp queries not working with E_CONTACT_UID
"is" sexp queries not working with E_CONTACT_UID
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Contacts
unspecified
Other All
: Normal normal
: ---
Assigned To: evolution-addressbook-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2005-07-01 13:23 UTC by Tom Copeland
Modified: 2005-07-13 13:22 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Tom Copeland 2005-07-01 13:23:17 UTC
Please describe the problem:
Here's a small program that illustrates the problem (at least on my
machine); note that the "is uid blah" query returns zero contacts but
when I get all contacts, the UID I'm looking for definitely exists:

======================================
[tom at tom evtest]$ cat evtest.c ; echo "OUTPUT" ; ./evtest
#include <stdio.h>
#include <libebook/e-book.h>
#include <libebook/e-contact.h>
#include <libecal/e-cal.h>

int main(int argc, char* argv[]) {
  GError* error = 0;
  GList* results, *l = NULL;
  EBook* book = e_book_new_default_addressbook(&error);
  e_book_open(book, TRUE, &error);
  char* uid = "pas-id-42B70B7100000001";
  EBookQuery* query = e_book_query_from_string(g_strdup_printf ("(is
\"id\" \"%s\")", uid));
  e_book_get_contacts(book, query, &results, &error);
  printf("Number of contacts with uid %s is %d\n", uid,
g_list_length(results));
  query = e_book_query_any_field_contains("");
  results = NULL;
  e_book_get_contacts(book, query, &results, &error);
  for (l = results; l; l = l->next) {
    EContact* ev_contact = E_CONTACT(l->data);
    if (!g_strcasecmp(e_contact_get(ev_contact, E_CONTACT_UID), uid)) {
      printf("Found a contact with uid %s, last name is %s\n", uid,
(char*)e_contact_get(ev_contact, E_CONTACT_GIVEN_NAME));
    }
  }
  e_book_query_unref(query);
  return 0;
}
OUTPUT
Number of contacts with uid pas-id-42B70B7100000001 is 0
Found a contact with uid pas-id-42B70B7100000001, last name is
jadmin at jabber.org
======================================

Steps to reproduce:
1. Please see the program in the description field.
2. 
3. 


Actual results:
Please see the program in the description field.

Expected results:
Please see the program in the description field.

Does this happen every time?
Yes

Other information:
Nope.
Comment 1 Sushma Rai 2005-07-04 08:08:15 UTC
This is a bug which needs to be fixed.
But you can use e_book_get_contact() to read the contact
when you are having the contact id, instead of forming the
querying.
Comment 2 Sushma Rai 2005-07-04 12:27:34 UTC
Fix committed to cvs head, along with fix for #242165
Comment 3 Tom Copeland 2005-07-13 13:22:58 UTC
Great, thanks very much Sushma!

tom