-/* $Id: zebraapi.c,v 1.134 2004-10-01 15:36:15 heikki Exp $
+/* $Id: zebraapi.c,v 1.135 2004-10-07 14:18:23 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
Res res;
yaz_log(LOG_API,"zebra_start %s",configName);
+ assert(configName);
if ((res = res_open (configName, def_res, over_res)))
{
void zebra_filter_info(ZebraService zs, void *cd,
void (*cb)(void *cd, const char *name))
{
+ ASSERTZS;
+ assert(cb);
recTypeClass_info(zs->record_classes, cd, cb);
}
void zebra_pidfname(ZebraService zs, char *path)
{
+ ASSERTZS;
zebra_lock_prefix (zs->global_res, path);
strcat(path, "zebrasrv.pid");
}
char resource_str[200];
const char *v;
sprintf (resource_str, "dict.%.100s.pagesize", name);
+ assert(bfs);
+ assert(name);
v = res_get(res, resource_str);
if (v)
static void zebra_register_close (ZebraService zs, struct zebra_register *reg)
{
ASSERTZS;
+ assert(reg);
yaz_log(LOG_DEBUG, "zebra_register_close p=%p", reg);
reg->stop_flag = 0;
zebra_chdir (zs);
struct map_baseinfo *p = (struct map_baseinfo *) vp;
int i, no;
char fromdb[128], todb[8][128];
+
+ assert(value);
+ assert(name);
+ assert(vp);
no =
sscanf (value, "%127s %127s %127s %127s %127s %127s %127s %127s %127s",
int i;
ASSERTZH;
yaz_log(LOG_API,"map_basenames ");
+ assert(stream);
+
zh->errCode=0;
info.zh = zh;
{
ASSERTZH;
yaz_log(LOG_API,"zebra_select_database %s",basename);
+ assert(basename);
zh->errCode=0;
return zebra_select_databases (zh, 1, &basename);
}
int len = 0;
char *new_reg = 0;
ASSERTZH;
+ assert(basenames);
+
yaz_log(LOG_API,"zebra_select_databases n=%d [0]=%s",
num_bases,basenames[0]);
zh->errCode=0;
const char *max;
zint maxhits;
ASSERTZH;
+ assert(o);
assert(query);
assert(hits);
assert(setname);
maxhits=atoi(max);
else {
int i=0;
- maxhits=INT_MAX;
+ maxhits=INT_MAX; /* properly rounded, to make it look like a limit*/
while (maxhits>100) { maxhits/=10; i++;}
while (i--) maxhits *= 10;
}
if (zh->hits > maxhits) { /* too large for yaz to handle */
logf(LOG_DEBUG,"limiting hits to "ZINT_FORMAT, maxhits);
- *hits=maxhits; /* round it down to two digits, to look like rounded */
+ *hits=maxhits;
}
else
*hits = zh->hits;
ZebraPosSet poset;
int i, *pos_array, ret = 0;
ASSERTZH;
+ assert(stream);
+ assert(setname);
+ assert(recs);
+ assert(num_recs>0);
+
yaz_log(LOG_API,"zebra_records_retrieve n=%d",num_recs);
zh->errCode=0;
int *is_partial)
{
ASSERTZH;
+ assert(stream);
+ assert(zapt);
+ assert(position);
+ assert(num_entries);
+ assert(is_partial);
+ assert(entries);
yaz_log(LOG_API,"zebra_scan");
zh->errCode=0;
if (zebra_begin_read (zh))
int *sort_status)
{
ASSERTZH;
+ assert(stream);
+ assert(num_input_setnames>0);
+ assert(input_setnames);
+ assert(sort_sequence);
+ assert(sort_status);
yaz_log(LOG_API,"zebra_sort");
zh->errCode=0;
if (zebra_begin_read (zh))
{
int i, status;
ASSERTZH;
+ assert(num_setnames>0);
+ assert(setnames);
+ assert(statuses);
yaz_log(LOG_API,"zebra_deleleResultSet n=%d",num_setnames);
zh->errCode=0;
if (zebra_begin_read(zh))
Z_NamePlusRecord *npr = segment->segmentRecords[i];
printf ("--------------%d--------------------\n", i);
+ /* FIXME - What! printing on stdout ??? */
if (npr->which == Z_NamePlusRecord_intermediateFragment)
{
Z_FragmentSyntax *fragment = npr->u.intermediateFragment;
char *rinfo = 0;
char recid_z[256];
ASSERTZH;
+ assert(action>0 && action <=4);
+ assert(rec_buf);
+
yaz_log(LOG_API,"zebra_admin_exchange_record ac=%d", action);
zh->errCode=0;
{
ZebraHandle zh = (ZebraHandle) handle;
ISAMC_P pos;
+ ASSERTZH;
if (*info == sizeof(pos))
{
int zebra_create_database (ZebraHandle zh, const char *database)
{
ASSERTZH;
- yaz_log(LOG_API,"zebra_create_database");
+ yaz_log(LOG_API,"zebra_create_database %s",database);
+ assert(database);
zh->errCode=0;
if (zebra_select_database (zh, database))
{
WRBUF wrbuf;
ASSERTZH;
+ assert(input_str);
+ assert(output_str);
yaz_log(LOG_API,"zebra_string_norm ");
zh->errCode=0;
if (!zh->reg->zebra_maps)
int zebra_set_state (ZebraHandle zh, int val, int seqno)
+ /* FIXME - zint seqno ?? */
{
char state_fname[256];
char *fname;
fname = zebra_mk_fname (res_get(zh->res, "lockDir"), state_fname);
f = fopen (fname, "w");
- yaz_log (LOG_DEBUG, "%c %d %ld", val, seqno, p);
+ yaz_log (LOG_DEBUG, "zebra_set_state: %c %d %ld", val, seqno, p);
fprintf (f, "%c %d %ld\n", val, seqno, p);
fclose (f);
xfree (fname);
{
const char *group = res_get(zh->res, "group");
const char *v;
+ /* FIXME - do we still use groups ?? */
zh->m_group = group;
v = res_get_prefix(zh->res, "followLinks", group, "1");
int zebra_begin_trans (ZebraHandle zh, int rw)
{
+ ASSERTZH;
if (!zh->res)
{
zh->errCode = 2;
int zebra_end_trans (ZebraHandle zh)
{
+ ASSERTZH;
ZebraTransactionStatus dummy;
yaz_log(LOG_API,"zebra_end_trans");
return zebra_end_transaction(zh, &dummy);
const char *rval;
ASSERTZH;
+ assert(status);
yaz_log(LOG_API,"zebra_end_transaction");
status->processed = 0;
int zebra_repository_update (ZebraHandle zh, const char *path)
{
ASSERTZH;
+ assert(path);
zh->errCode=0;
logf (LOG_API, "updating %s", path);
repositoryUpdate (zh, path);
int zebra_repository_delete (ZebraHandle zh, const char *path)
{
ASSERTZH;
+ assert(path);
zh->errCode=0;
logf (LOG_API, "deleting %s", path);
repositoryDelete (zh, path);
int zebra_repository_show (ZebraHandle zh, const char *path)
{
ASSERTZH;
+ assert(path);
yaz_log(LOG_API,"zebra_repository_show");
zh->errCode=0;
repositoryShow (zh, path);
int zebra_clean (ZebraHandle zh)
{
+ ASSERTZH;
yaz_log(LOG_API,"zebra_clean");
return zebra_commit_ex(zh, 1);
}
int zebra_commit (ZebraHandle zh)
{
+ ASSERTZH;
yaz_log(LOG_API,"zebra_commit");
return zebra_commit_ex(zh, 0);
}
int zebra_record_encoding (ZebraHandle zh, const char *encoding)
{
ASSERTZH;
+ assert(encoding);
yaz_log(LOG_API,"zebra_record_encoding");
zh->errCode=0;
xfree (zh->record_encoding);
int zebra_set_resource(ZebraHandle zh, const char *name, const char *value)
{
ASSERTZH;
+ assert(name);
+ assert(value);
yaz_log(LOG_API,"zebra_set_resource %s:%s",name,value);
zh->errCode=0;
res_set(zh->res, name, value);
{
const char *v;
ASSERTZH;
+ assert(name);
+ assert(defaultvalue);
v= res_get_def( zh->res, name, (char *)defaultvalue);
zh->errCode=0;
yaz_log(LOG_API,"zebra_get_resource %s:%s",name,v);
int zebra_get_shadow_enable (ZebraHandle zh)
{
+ ASSERTZH;
yaz_log(LOG_API,"zebra_get_shadow_enable");
return (zh->shadow_enable);
}
int zebra_set_shadow_enable (ZebraHandle zh, int value)
{
+ ASSERTZH;
yaz_log(LOG_API,"zebra_set_shadow_enable %d",value);
zh->shadow_enable = value;
return 0;
{
ZebraPosSet poset;
int i, *pos_array;
+ ASSERTZH;
+ assert(stream);
+ assert(setname);
+ assert(comp);
+ assert(recs);
+ assert(num_recs>0);
yaz_log(LOG_API,"api_records_retrieve s=%s n=%d",setname,num_recs);
if (!zh->res)
const char *buf, int buf_size, int force_update)
{
int res;
+ ASSERTZH;
+ assert(sysno);
+ assert(buf);
yaz_log(LOG_API, "zebra_insert_record sysno=" ZINT_FORMAT, *sysno);
if (buf_size < 1) buf_size = strlen(buf);
int force_update)
{
int res;
+ ASSERTZH;
+ assert(sysno);
+ assert(buf);
yaz_log(LOG_API, "zebra_update_record sysno=" ZINT_FORMAT, *sysno);
int force_update)
{
int res;
+ ASSERTZH;
+ assert(sysno);
+ assert(buf);
yaz_log(LOG_API, "zebra_delete_record sysno=" ZINT_FORMAT, *sysno);
if (buf_size < 1) buf_size = strlen(buf);
int res=-1;
Z_RPNQuery *query;
ODR odr = odr_createmem(ODR_ENCODE);
+ ASSERTZH;
+ assert(pqf_query);
+ assert(setname);
yaz_log(LOG_API,"zebra_search_PQF s=%s q=%s",setname, pqf_query);
{
int num_input_setnames = 0;
int sort_status = 0;
- Z_SortKeySpecList *sort_sequence = yaz_sort_spec (stream, sort_spec);
+ Z_SortKeySpecList *sort_sequence;
+ ASSERTZH;
+ assert(stream);
+ assert(sort_spec);
+ assert(output_setname);
+ assert(input_setnames);
+ sort_sequence = yaz_sort_spec (stream, sort_spec);
yaz_log(LOG_API,"sort (FIXME) ");
if (!sort_sequence)
{