-/* $Id: extract.c,v 1.210 2006-05-10 12:31:08 adam Exp $
+/* $Id: extract.c,v 1.213 2006-05-17 17:46:45 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
#include <direntz.h>
#include <charmap.h>
-#if _FILE_OFFSET_BITS == 64
-#define PRINTF_OFF_T "%Ld"
+#ifdef WIN32
+#define PRINTF_OFF_T "%I64d"
+#else
+/* !WIN32 */
+#if SIZEOF_OFF_T == SIZEOF_LONG_LONG
+#define PRINTF_OFF_T "%lld"
#else
#define PRINTF_OFF_T "%ld"
#endif
+#endif
+
+
#define USE_SHELLSORT 0
#if USE_SHELLSORT
}
}
+static void extract_add_index_string (RecWord *p, const char *str, int length);
+
static void extract_set_store_data_prepare(struct recExtractCtrl *p);
static void extract_init (struct recExtractCtrl *p, RecWord *w)
ctrl->flagShowRecords = !zh->m_flag_rw;
}
+static void all_matches_add(struct recExtractCtrl *ctrl)
+{
+ RecWord word;
+ extract_init(ctrl, &word);
+ word.index_name = "allrecords";
+ word.index_type = 'w';
+ word.seqno = 1;
+ extract_add_index_string (&word, "", 0);
+}
+
static ZEBRA_RES file_extract_record(ZebraHandle zh,
SYSNO *sysno, const char *fname,
int deleteFlag,
RecType recType,
void *recTypeClientData)
{
+ const char *match_str_to_print = "";
RecordAttr *recordAttr;
int r;
const char *matchStr = 0;
}
return ZEBRA_FAIL;
}
+ all_matches_add(&extractCtrl);
if (extractCtrl.match_criteria[0])
- matchStr = extractCtrl.match_criteria;
+ matchStr = extractCtrl.match_criteria;
}
- /* perform match if sysno not known and if match criteria is specified */
+ /* if matchStr is set now - we assume it's printable .
+ For internal matchStr (see below) we don't print */
+ if (matchStr)
+ match_str_to_print = matchStr;
+
+ /* perform internal match if sysno not known and if match criteria is
+ specified already */
if (!sysno)
{
sysnotmp = 0;
if (zh->records_processed < zh->m_file_verbose_limit)
{
- if (matchStr)
- yaz_log(YLOG_LOG, "add %s %s " PRINTF_OFF_T
- " " ZINT_FORMAT " %s" ,
- zh->m_record_type,
- fname, recordOffset, *sysno, matchStr);
- else
- yaz_log(YLOG_LOG, "add %s %s " PRINTF_OFF_T
- " " ZINT_FORMAT ,
- zh->m_record_type,
- fname, recordOffset, *sysno);
+ yaz_log(YLOG_LOG, "add %s %s " PRINTF_OFF_T
+ " " ZINT_FORMAT " %s" ,
+ zh->m_record_type,
+ fname, recordOffset, *sysno, match_str_to_print);
}
recordAttr = rec_init_attr (zh->reg->zei, rec);
recordAttr->staticrank = extractCtrl.staticrank;
{
if (zh->records_processed < zh->m_file_verbose_limit)
{
- if (matchStr)
- yaz_log(YLOG_LOG, "delete %s %s " PRINTF_OFF_T
- " " ZINT_FORMAT " %s" ,
- zh->m_record_type,
- fname, recordOffset, *sysno, matchStr);
- else
- yaz_log(YLOG_LOG, "delete %s %s " PRINTF_OFF_T
- " " ZINT_FORMAT ,
- zh->m_record_type,
- fname, recordOffset, *sysno);
+ yaz_log(YLOG_LOG, "delete %s %s " PRINTF_OFF_T
+ " " ZINT_FORMAT " %s" ,
+ zh->m_record_type,
+ fname, recordOffset, *sysno, match_str_to_print);
}
zh->records_deleted++;
if (matchStr)
/* flush new keys for sort&search etc */
if (zh->records_processed < zh->m_file_verbose_limit)
{
- if (matchStr)
- yaz_log(YLOG_LOG, "update %s %s " PRINTF_OFF_T
- " " ZINT_FORMAT " %s" ,
- zh->m_record_type,
- fname, recordOffset, *sysno, matchStr);
- else
- yaz_log(YLOG_LOG, "update %s %s " PRINTF_OFF_T
- " " ZINT_FORMAT ,
- zh->m_record_type,
- fname, recordOffset, *sysno);
+ yaz_log(YLOG_LOG, "update %s %s " PRINTF_OFF_T
+ " " ZINT_FORMAT " %s" ,
+ zh->m_record_type,
+ fname, recordOffset, *sysno, match_str_to_print);
}
recordAttr->staticrank = extractCtrl.staticrank;
#if NATTR
return ZEBRA_FAIL;
}
+ all_matches_add(&extractCtrl);
+
if (extractCtrl.match_criteria[0])
match_criteria = extractCtrl.match_criteria;
}
}
-void extract_add_index_string (RecWord *p, const char *str, int length)
+void extract_add_index_string(RecWord *p, const char *str, int length)
{
struct it_key key;