1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2010 Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 /* Creates a few result sets */
24 const char *myrec[] ={
26 " <title>My title</title>\n"
30 static void tst(int argc, char **argv)
33 ZebraService zs = tl_start_up(0, argc, argv);
34 ZebraHandle zh = zebra_open(zs, 0);
36 YAZ_CHECK(tl_init_data(zh, myrec));
41 char *setnamep = setname;
43 ODR odr_input = odr_createmem (ODR_DECODE);
44 ODR odr_output = odr_createmem (ODR_ENCODE);
45 YAZ_PQF_Parser parser = yaz_pqf_create();
46 Z_RPNQuery *query = yaz_pqf_parse(parser, odr_input,
49 if (zebra_begin_trans (zh, 1) != ZEBRA_OK)
51 fprintf(stderr, "zebra_begin_trans failed\n");
54 if (zebra_begin_trans (zh, 0) != ZEBRA_OK)
56 fprintf(stderr, "zebra_begin_trans failed\n");
60 sprintf(setname, "s%d", i+1);
61 zebra_search_RPN (zh, odr_input, query, setname, &hits);
63 if (zebra_end_trans (zh) != ZEBRA_OK)
65 fprintf(stderr, "zebra_end_trans failed\n");
68 if (zebra_end_trans (zh) != ZEBRA_OK)
70 fprintf(stderr, "zebra_end_trans failed\n");
73 yaz_pqf_destroy(parser);
74 zebra_deleteResultSet(zh, Z_DeleteResultSetRequest_list,
75 1, &setnamep, &status);
76 odr_destroy(odr_input);
77 odr_destroy(odr_output);
81 YAZ_CHECK(tl_close_down(zh, zs));
89 * c-file-style: "Stroustrup"
90 * indent-tabs-mode: nil
92 * vim: shiftwidth=4 tabstop=8 expandtab