-/* $Id: t4.c,v 1.4 2003-10-21 09:59:05 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+/* $Id: t4.c,v 1.11 2004-10-29 13:02:39 heikki Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
This file is part of the Zebra server.
02111-1307, USA.
*/
-#include <yaz/log.h>
-#include <yaz/pquery.h>
-#include <zebraapi.h>
+/* t4 - insert a small pile of records, search and fetch them */
+#include "testlib.h"
+
+const char *myrec[] = {
+ "<gils>\n"
+ " <title>My title</title>\n"
+ "</gils>\n",
+ 0};
+
int main(int argc, char **argv)
{
int i;
- ZebraService zs;
- ZebraHandle zh;
- const char *myrec =
- "<gils>\n"
- " <title>My title</title>\n"
- "</gils>\n";
+ ZebraService zs = start_up(0, argc, argv);;
+ ZebraHandle zh = zebra_open (zs);
- yaz_log_init_file("t4.log");
-
- nmem_init ();
-
- zs = zebra_start("t2.cfg");
- zh = zebra_open (zs);
- zebra_select_database(zh, "Default");
+ init_data(zh,myrec);
zebra_begin_trans (zh, 1);
for (i = 0; i<1200; i++)
- zebra_record_insert (zh, myrec, strlen(myrec),0);
+ zebra_add_record (zh, myrec[0], strlen(myrec[0]));
zebra_end_trans (zh);
zebra_close(zh);
zebra_stop(zs);
- zs = zebra_start("t2.cfg");
+ zs = start_service("");
zh = zebra_open (zs);
zebra_select_database(zh, "Default");
}
zebra_commit (zh);
- zebra_close (zh);
- zebra_stop (zs);
-
- nmem_exit ();
- xmalloc_trav ("x");
- exit (0);
+ return close_down(zh,zs,0);
}