-/* $Id: zebraapi.c,v 1.143 2004-12-02 17:27:03 adam Exp $
+/* $Id: zebraapi.c,v 1.145 2004-12-21 22:00:57 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
static Res zebra_open_res (ZebraHandle zh);
static void zebra_close_res (ZebraHandle zh);
-
static void zebra_chdir (ZebraService zs)
{
const char *dir ;
zh->shadow_enable = 1;
default_encoding = res_get_def(zs->global_res, "encoding", "ISO-8859-1");
- zh->record_encoding = xstrdup (default_encoding);
zh->iconv_to_utf8 =
yaz_iconv_open ("UTF-8", default_encoding);
yaz_log (YLOG_WARN, "iconv: UTF-8 to %s unsupported",
default_encoding);
+ zh->record_encoding = 0;
+
zebra_mutex_cond_lock (&zs->session_lock);
zh->next = zs->sessions;
if (!(reg->records = rec_open (reg->bfs, rw, record_compression)))
{
- yaz_log (YLOG_WARN, "rec_open");
+ yaz_log (YLOG_WARN, "rec_open failed");
return 0;
}
if (rw)
}
if (!(reg->dict = dict_open_res (reg->bfs, FNAME_DICT, 40, rw, 0, res)))
{
- yaz_log (YLOG_WARN, "dict_open");
+ yaz_log (YLOG_WARN, "dict_open failed");
return 0;
}
if (!(reg->sortIdx = sortIdx_open (reg->bfs, rw)))
{
- yaz_log (YLOG_WARN, "sortIdx_open");
+ yaz_log (YLOG_WARN, "sortIdx_open failed");
return 0;
}
if (res_get_match (res, "isam", "s", ISAM_DEFAULT))
if (!(reg->isams = isams_open (reg->bfs, FNAME_ISAMS, rw,
key_isams_m(res, &isams_m))))
{
- yaz_log (YLOG_WARN, "isams_open");
+ yaz_log (YLOG_WARN, "isams_open failed");
return 0;
}
}
if (!(reg->isamc = isc_open (reg->bfs, FNAME_ISAMC,
rw, key_isamc_m(res, &isamc_m))))
{
- yaz_log (YLOG_WARN, "isc_open");
+ yaz_log (YLOG_WARN, "isc_open failed");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), 0)))
{
- yaz_log (YLOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open failed");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), 1)))
{
- yaz_log (YLOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open failed");
return 0;
}
}
if (!(reg->isamb = isamb_open (reg->bfs, "isamb",
rw, key_isamc_m(res, &isamc_m), -1)))
{
- yaz_log (YLOG_WARN, "isamb_open");
+ yaz_log (YLOG_WARN, "isamb_open failed");
return 0;
}
}
}
#if HAVE_SYS_TIMES_H
times (&zh->tms2);
- yaz_log (YLOG_LOG, "user/system: %ld/%ld",
+ yaz_log (log_level, "user/system: %ld/%ld",
(long) (zh->tms2.tms_utime - zh->tms1.tms_utime),
(long) (zh->tms2.tms_stime - zh->tms1.tms_stime));
rval = res_get (zh->res, "shadow");
if (!rval)
{
- yaz_log (YLOG_WARN, "Cannot perform commit");
- yaz_log (YLOG_WARN, "No shadow area defined");
+ yaz_log (YLOG_WARN, "Cannot perform commit - No shadow area defined");
return 0;
}
}
else
{
- yaz_log (YLOG_LOG, "nothing to commit");
+ yaz_log (log_level, "nothing to commit");
}
bfs_destroy (bfs);
return 0;
}
-int zebra_record_encoding (ZebraHandle zh, const char *encoding)
+int zebra_octet_term_encoding(ZebraHandle zh, const char *encoding)
{
ASSERTZH;
assert(encoding);
- yaz_log(log_level,"zebra_record_encoding");
- zh->errCode=0;
- xfree (zh->record_encoding);
-
- /*
- * Fixme!
- * Something about charset aliases. Oleg???
- */
+ yaz_log(log_level,"zebra_octet_term_encoding");
+ zh->errCode = 0;
if (zh->iconv_to_utf8 != 0)
yaz_iconv_close(zh->iconv_to_utf8);
if (zh->iconv_from_utf8 != 0)
yaz_iconv_close(zh->iconv_from_utf8);
- zh->record_encoding = xstrdup (encoding);
-
- yaz_log(YLOG_DEBUG, "Reset record encoding: %s", encoding);
-
zh->iconv_to_utf8 =
yaz_iconv_open ("UTF-8", encoding);
if (zh->iconv_to_utf8 == 0)
return 0;
}
+int zebra_record_encoding (ZebraHandle zh, const char *encoding)
+{
+ ASSERTZH;
+ yaz_log(log_level,"zebra_record_encoding");
+ zh->errCode = 0;
+ xfree (zh->record_encoding);
+ zh->record_encoding = 0;
+ if (encoding)
+ zh->record_encoding = xstrdup (encoding);
+ return 0;
+}
+
int zebra_set_resource(ZebraHandle zh, const char *name, const char *value)
{
ASSERTZH;