a98b175d271cd17a1660547ab2c912587ef0212a
[idzebra-moved-to-github.git] / test / api / t14.c
1 /* $Id: t14.c,v 1.2 2006-02-09 08:31:02 adam Exp $
2    Copyright (C) 2004-2005
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 Zebra; see the file LICENSE.zebra.  If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
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     ZEBRA_RES res;
30
31     res = zebra_create_database (zh, "Default");
32     TL_ASSERT(res == ZEBRA_OK);
33
34     /* bug #447 */
35     res = zebra_admin_exchange_record (
36         zh, rec, strlen(rec),
37         opaque_id, strlen(opaque_id),
38         1); /* insert */
39     TL_ASSERT(res == ZEBRA_OK);
40
41     res = zebra_admin_exchange_record (
42         zh, rec, strlen(rec),
43         opaque_id, strlen(opaque_id),
44         4); /* update/insert */
45
46     TL_ASSERT(res == ZEBRA_OK);
47     do_query(__LINE__, zh, "@attr 1=4 some", 1);
48
49     zebra_drop_database(zh, "Default");
50
51     do_query_x(__LINE__, zh, "@attr 1=4 some", 0, 109);
52
53 }
54
55 int main(int argc, char **argv)
56 {
57     ZebraService zs = start_up("zebra.cfg", argc, argv);
58     ZebraHandle zh = zebra_open(zs, 0);
59     ZEBRA_RES res;
60
61     res = zebra_select_database(zh, "Default");
62     TL_ASSERT(res == ZEBRA_OK);
63
64     zebra_init(zh);
65
66     create_search_drop(zh);
67     /* bug #447 */
68     create_search_drop(zh);
69
70     return close_down(zh, zs, 0);
71 }
72
73