-/* $Id: zebraapi.c,v 1.120.2.3 2005-01-21 13:23:03 adam Exp $
+/* $Id: zebraapi.c,v 1.120.2.4 2005-01-23 14:59:42 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
logf (LOG_LOG, "base %s", (*basenames)[i]);
}
+int zebra_select_default_database(ZebraHandle zh)
+{
+ if (!zh->res)
+ {
+ /* no database has been selected - so we select based on
+ resource setting (including group)
+ */
+ const char *group = res_get(zh->service->global_res, "group");
+ const char *v = res_get_prefix(zh->service->global_res,
+ "database", group, "Default");
+ zebra_select_database(zh, v);
+ }
+ return 0;
+}
+
int zebra_select_database (ZebraHandle zh, const char *basename)
{
ASSERTZH;
int zebra_begin_trans (ZebraHandle zh, int rw)
{
- if (!zh->res)
- {
- /* no database has been selected - so we select based on
- resource setting (including group)
- */
- const char *group = res_get(zh->service->global_res, "group");
- const char *v = res_get_prefix(zh->service->global_res,
- "database", group, "Default");
- zebra_select_database(zh, v);
- }
+ zebra_select_default_database(zh);
if (!zh->res)
{
zh->errCode = 2;
ASSERTZH;
zh->errCode=0;
+ zebra_select_default_database(zh);
if (!zh->res)
{
zh->errCode = 109;
yaz_log(LOG_API,"zebra_init");
zh->errCode=0;
+ zebra_select_default_database(zh);
if (!zh->res)
{
zh->errCode = 109;
}
rval = res_get (zh->res, "shadow");
- bfs = bfs_create (res_get (zh->service->global_res, "register"),
- zh->path_reg);
+ bfs = bfs_create (res_get (zh->res, "register"), zh->path_reg);
if (!bfs)
return -1;
if (rval && *rval)