1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2011 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 */
27 static void tst(int argc, char **argv)
31 ZebraService zs = tl_start_up(0, argc, argv);
32 ZebraHandle zh = zebra_open(zs, 0);
34 YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
35 YAZ_CHECK(zebra_init(zh) == ZEBRA_OK);
38 zh = zebra_open(zs, 0);
41 YAZ_CHECK(zebra_begin_trans (zh, 1) == ZEBRA_OK);
43 for (i = 0; i<no_db; i++)
48 sprintf(dbstr, "%d", i);
49 YAZ_CHECK(zebra_select_database(zh, dbstr) == ZEBRA_OK);
51 sprintf(rec_buf, "<gils><title>title %d</title></gils>\n", i);
52 zebra_add_record (zh, rec_buf, strlen(rec_buf));
55 YAZ_CHECK(zebra_end_trans(zh) == ZEBRA_OK);
58 zh = zebra_open(zs, 0);
60 for (i = 0; i<=no_db; i++)
64 sprintf(dbstr, "%d", i);
65 YAZ_CHECK(zebra_select_database(zh, dbstr) == ZEBRA_OK);
67 sprintf(querystr, "@attr 1=4 %d", i);
70 YAZ_CHECK(tl_query_x(zh, querystr, 0, 109));
74 YAZ_CHECK(tl_query(zh, querystr, 1));
77 YAZ_CHECK(tl_close_down(zh, zs));
85 * c-file-style: "Stroustrup"
86 * indent-tabs-mode: nil
88 * vim: shiftwidth=4 tabstop=8 expandtab