1 /* $Id: t12.c,v 1.6 2007-01-15 15:10:20 adam Exp $
2 Copyright (C) 1995-2007
5 This file is part of the Zebra server.
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
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
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
23 /** 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 * indent-tabs-mode: nil
87 * vim: shiftwidth=4 tabstop=8 expandtab