2 * $Id: zoomtst2.c,v 1.7 2006-03-01 23:24:26 adam Exp $
4 * Asynchronous single-target client performing search (no retrieval)
12 int main(int argc, char **argv)
17 const char *errmsg, *addinfo, *diagset;
21 fprintf (stderr, "usage:\n%s target query\n", *argv);
23 "Verify: asynchronous single-target client\n");
27 /* create connection (don't connect yet) */
28 z = ZOOM_connection_create(0);
30 /* option: set sru/get operation (only applicable if http: is used) */
31 ZOOM_connection_option_set (z, "sru", "post");
33 /* option: set async operation */
34 ZOOM_connection_option_set (z, "async", "1");
36 /* connect to target and initialize */
37 ZOOM_connection_connect (z, argv[1], 0);
39 /* search using prefix query format */
40 r = ZOOM_connection_search_pqf (z, argv[2]);
42 /* block here: only one connection */
43 while (ZOOM_event (1, &z))
46 /* see if any error occurred */
47 if ((error = ZOOM_connection_error_x(z, &errmsg, &addinfo, &diagset)))
49 fprintf (stderr, "Error: %s: %s (%d) %s\n", diagset, errmsg, error,
53 else /* OK print hit count */
54 printf ("Result count: %d\n", ZOOM_resultset_size(r));
55 ZOOM_resultset_destroy (r);
56 ZOOM_connection_destroy (z);
62 * indent-tabs-mode: nil
64 * vim: shiftwidth=4 tabstop=8 expandtab