-/* $Id: zebraapi.c,v 1.113 2003-08-21 10:30:04 adam Exp $
+/* $Id: zebraapi.c,v 1.114 2003-09-05 10:51:17 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
02111-1307, USA.
*/
-
-
#include <assert.h>
#include <stdio.h>
#ifdef WIN32
int zebra_drop_database (ZebraHandle zh, const char *database)
{
+ int ret = 0;
ASSERTZH;
yaz_log(LOG_API,"zebra_drop_database");
zh->errCode = 0;
zebraExplain_trav_ord(zh->reg->zei, zh, delete_SU_handle);
zebraExplain_removeDatabase(zh->reg->zei, zh);
}
+ else
+ {
+ yaz_log(LOG_WARN, "drop database only supported for isam:b");
+ ret = -1;
+ }
zebra_end_trans (zh);
- return 0;
+ return ret;
}
int zebra_create_database (ZebraHandle zh, const char *database)
int zebra_begin_trans (ZebraHandle zh, int rw)
{
- yaz_log(LOG_LOG, "zebra_begin_trans rw=%d trans=%d", rw, zh->trans_no);
if (!zh->res)
{
zh->errCode = 2;
-/* $Id: zrpn.c,v 1.133 2003-04-15 20:48:04 adam Exp $
+/* $Id: zrpn.c,v 1.134 2003-09-05 10:51:17 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
struct rpn_char_map_info rcmi;
int space_split = complete_flag ? 0 : 1;
+ int bases_ok = 0; /* no of databases with OK attribute */
+ int errCode = 0; /* err code (if any is not OK) */
+ char *errString = 0; /* addinfo */
+
rpn_char_map_prepare (zh->reg, reg_type, &rcmi);
attr_init (&use, zapt, 1);
use_value = attr_find_ex (&use, &curAttributeSet, &use_string);
/* set was found, but value wasn't defined */
char val_str[32];
sprintf (val_str, "%d", use_value);
- zh->errCode = 114;
- zh->errString = nmem_strdup (stream, val_str);
+ errCode = 114;
+ errString = nmem_strdup (stream, val_str);
}
else
{
oident.value = curAttributeSet;
oid_ent_to_oid (&oident, oid);
- zh->errCode = 121;
- zh->errString = nmem_strdup (stream, oident.desc);
+ errCode = 121;
+ errString = nmem_strdup (stream, oident.desc);
}
- return -1;
+ continue;
}
}
for (local_attr = attp.local_attributes; local_attr;
{
char val_str[32];
sprintf (val_str, "%d", use_value);
- zh->errCode = 114;
- zh->errString = nmem_strdup (stream, val_str);
- return -1;
+ errCode = 114;
+ errString = nmem_strdup (stream, val_str);
+ continue;
}
+ bases_ok++; /* this has OK attributes */
+
term_dict[prefix_len++] = ')';
term_dict[prefix_len++] = 1;
term_dict[prefix_len++] = reg_type;
break;
}
}
+ if (!bases_ok)
+ {
+ zh->errCode = errCode;
+ zh->errString = errString;
+ return -1;
+ }
*term_sub = termp;
logf (LOG_DEBUG, "%d positions", grep_info->isam_p_indx);
return 1;
const char *termp;
struct rpn_char_map_info rcmi;
+ int bases_ok = 0; /* no of databases with OK attribute */
+ int errCode = 0; /* err code (if any is not OK) */
+ char *errString = 0; /* addinfo */
+
rpn_char_map_prepare (zh->reg, reg_type, &rcmi);
attr_init (&use, zapt, 1);
use_value = attr_find_ex (&use, &curAttributeSet, &use_string);
{
char val_str[32];
sprintf (val_str, "%d", use_value);
- zh->errString = nmem_strdup (stream, val_str);
- zh->errCode = 114;
+ errString = nmem_strdup (stream, val_str);
+ errCode = 114;
}
else
- zh->errCode = 121;
- return -1;
+ errCode = 121;
+ continue;
}
}
if (zebraExplain_curDatabase (zh->reg->zei, basenames[base_no]))
{
char val_str[32];
sprintf (val_str, "%d", use_value);
- zh->errCode = 114;
- zh->errString = nmem_strdup (stream, val_str);
- return -1;
+ errCode = 114;
+ errString = nmem_strdup (stream, val_str);
+ continue;
}
+ bases_ok++;
term_dict[prefix_len++] = ')';
term_dict[prefix_len++] = 1;
term_dict[prefix_len++] = reg_type;
term_dst))
return 0;
}
+ if (!bases_ok)
+ {
+ zh->errCode = errCode;
+ zh->errString = errString;
+ return -1;
+ }
*term_sub = termp;
logf (LOG_DEBUG, "%d positions", grep_info->isam_p_indx);
return 1;
int ords[32], ord_no = 0;
int ptr[32];
+ int bases_ok = 0; /* no of databases with OK attribute */
+ int errCode = 0; /* err code (if any is not OK) */
+ char *errString = 0; /* addinfo */
+
unsigned reg_id;
char *search_type = NULL;
char rank_type[128];
{
char val_str[32];
sprintf (val_str, "%d", use_value);
- zh->errCode = 114;
- zh->errString = odr_strdup (stream, val_str);
+ errCode = 114;
+ errString = odr_strdup (stream, val_str);
}
else
- zh->errCode = 121;
- *num_entries = 0;
- return;
+ errCode = 121;
+ continue;
}
if (zebraExplain_curDatabase (zh->reg->zei, basenames[base_no]))
{
*num_entries = 0;
return;
}
+ bases_ok++;
for (local_attr = attp.local_attributes; local_attr && ord_no < 32;
local_attr = local_attr->next)
{
ords[ord_no++] = ord;
}
}
+ if (!bases_ok && errCode)
+ {
+ zh->errCode = errCode;
+ zh->errString = errString;
+ *num_entries = 0;
+ }
if (ord_no == 0)
{
+ char val_str[32];
+ sprintf (val_str, "%d", use_value);
+ zh->errCode = 114;
+ zh->errString = odr_strdup (stream, val_str);
+
*num_entries = 0;
- zh->errCode = 113;
return;
}
/* prepare dictionary scanning */