1 /* This file is part of the Zebra server.
2 Copyright (C) 1995-2008 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 /** Create many databases */
24 static void tst(int argc, char **argv)
28 ZebraService zs = tl_start_up(0, argc, argv);
29 ZebraHandle zh = zebra_open(zs, 0);
31 YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
32 YAZ_CHECK(zebra_init(zh) == ZEBRA_OK);
35 zh = zebra_open(zs, 0);
38 YAZ_CHECK(zebra_begin_trans (zh, 1) == ZEBRA_OK);
40 for (i = 0; i<no_db; i++)
45 sprintf(dbstr, "%d", i);
46 YAZ_CHECK(zebra_select_database(zh, dbstr) == ZEBRA_OK);
48 sprintf(rec_buf, "<gils><title>title %d</title></gils>\n", i);
49 zebra_add_record (zh, rec_buf, strlen(rec_buf));
52 YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK);
55 zh = zebra_open(zs, 0);
57 for (i = 0; i<=no_db; i++)
61 sprintf(dbstr, "%d", i);
62 YAZ_CHECK(zebra_select_database(zh, dbstr) == ZEBRA_OK);
64 sprintf(querystr, "@attr 1=4 %d", i);
67 YAZ_CHECK(tl_query_x(zh, querystr, 0, 109));
71 YAZ_CHECK(tl_query(zh, querystr, 1));
74 YAZ_CHECK(tl_close_down(zh, zs));
82 * indent-tabs-mode: nil
84 * vim: shiftwidth=4 tabstop=8 expandtab