Update copyright year + FSF address
[idzebra-moved-to-github.git] / test / api / t14.c
1 /* $Id: t14.c,v 1.5 2006-08-14 10:40:22 adam Exp $
2    Copyright (C) 2004-2006
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21 */
22
23 #include "testlib.h"
24
25 static void create_search_drop(ZebraHandle zh)
26 {
27     const char *rec = "<gils><title>some</title></gils>";
28     const char *opaque_id = "9";
29
30     YAZ_CHECK(zebra_create_database (zh, "Default") == ZEBRA_OK);
31
32     /* bug #447 */
33     YAZ_CHECK(zebra_admin_exchange_record (
34                   zh, rec, strlen(rec),
35                   opaque_id, strlen(opaque_id),
36                   1) == ZEBRA_OK); /* insert */
37
38     YAZ_CHECK(zebra_admin_exchange_record (
39         zh, rec, strlen(rec),
40         opaque_id, strlen(opaque_id),
41         4) == ZEBRA_OK); /* update/insert */
42
43     YAZ_CHECK(tl_query(zh, "@attr 1=4 some", 1));
44
45     zebra_drop_database(zh, "Default");
46
47     YAZ_CHECK(tl_query_x(zh, "@attr 1=4 some", 0, 109));
48
49 }
50
51 static void tst(int argc, char **argv)
52 {
53     ZebraService zs = tl_start_up("zebra.cfg", argc, argv);
54     ZebraHandle zh = zebra_open(zs, 0);
55
56     YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
57
58     zebra_init(zh);
59
60     create_search_drop(zh);
61     /* bug #447 */
62     create_search_drop(zh);
63
64     YAZ_CHECK(tl_close_down(zh, zs));
65 }
66
67 TL_MAIN
68 /*
69  * Local variables:
70  * c-basic-offset: 4
71  * indent-tabs-mode: nil
72  * End:
73  * vim: shiftwidth=4 tabstop=8 expandtab
74  */
75