From: Adam Dickmeiss Date: Fri, 21 Jan 2005 13:23:03 +0000 (+0000) Subject: Fixed bug #253: Setting group.database not honored. X-Git-Tag: ZEBRA.1.3.22~5 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=ce5b11067a57e745a50e2f6eea3dea4711e6785b;p=idzebra-moved-to-github.git Fixed bug #253: Setting group.database not honored. --- diff --git a/index/main.c b/index/main.c index 069bf94..f73fff2 100644 --- a/index/main.c +++ b/index/main.c @@ -1,5 +1,5 @@ -/* $Id: main.c,v 1.112.2.1 2004-09-26 20:49:02 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 +/* $Id: main.c,v 1.112.2.2 2005-01-21 13:23:03 adam Exp $ + Copyright (C) 1995-2005 Index Data Aps This file is part of the Zebra server. @@ -56,7 +56,7 @@ int main (int argc, char **argv) char *configName = 0; int nsections = 0; int enable_commit = 1; - char *database = "Default"; + char *database = 0; Res res = res_open(0, 0, 0); int trans_started=0; @@ -132,7 +132,7 @@ int main (int argc, char **argv) zebra_shadow_enable (zh, enable_commit); } - if (zebra_select_database (zh, database)) + if (database && zebra_select_database (zh, database)) { logf(LOG_FATAL, "Could not select database %s errCode=%d", database, zebra_errCode(zh) ); diff --git a/index/zebraapi.c b/index/zebraapi.c index ff98ef1..e8aa764 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.120.2.2 2004-11-26 11:06:12 adam Exp $ +/* $Id: zebraapi.c,v 1.120.2.3 2005-01-21 13:23:03 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -1319,6 +1319,16 @@ 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); + } + if (!zh->res) + { zh->errCode = 2; zh->errString = "zebra_begin_trans: no database selected"; return -1;