2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.53 1996-04-26 12:09:43 adam
8 * Added a few comments.
10 * Revision 1.52 1996/04/25 13:27:57 adam
11 * Function recordExtract modified so that files with no keys (possibly empty)
14 * Revision 1.51 1996/03/19 11:08:42 adam
15 * Bug fix: Log preamble wasn't always turned off after recordExtract.
17 * Revision 1.50 1996/02/12 18:45:36 adam
18 * New fileVerboseFlag in record group control.
20 * Revision 1.49 1996/02/05 12:29:57 adam
21 * Logging reduced a bit.
22 * The remaining running time is estimated during register merge.
24 * Revision 1.48 1996/02/01 20:53:26 adam
25 * The temporary per-record keys are compacted a little, and duplication
26 * of the per-records keys are avoided when they are saved in the record
29 * Revision 1.47 1996/01/17 14:57:48 adam
30 * Prototype changed for reader functions in extract/retrieve. File
31 * is identified by 'void *' instead of 'int.
33 * Revision 1.46 1995/12/15 14:57:16 adam
36 * Revision 1.45 1995/12/15 12:37:41 adam
37 * In addRecordKeyAny: Writes key only when attrSet != -1.
39 * Revision 1.44 1995/12/12 16:00:54 adam
40 * System call sync(2) used after update/commit.
41 * Locking (based on fcntl) uses F_EXLCK and F_SHLCK instead of F_WRLCK
44 * Revision 1.43 1995/12/11 09:12:46 adam
45 * The rec_get function returns NULL if record doesn't exist - will
46 * happen in the server if the result set records have been deleted since
47 * the creation of the set (i.e. the search).
48 * The server saves a result temporarily if it is 'volatile', i.e. the
49 * set is register dependent.
51 * Revision 1.42 1995/12/07 17:38:46 adam
52 * Work locking mechanisms for concurrent updates/commit.
54 * Revision 1.41 1995/12/06 16:06:42 adam
55 * Better diagnostics. Work on 'real' dictionary deletion.
57 * Revision 1.40 1995/12/05 16:57:40 adam
58 * More work on regular patterns.
60 * Revision 1.39 1995/12/05 13:20:18 adam
61 * Bug fix: file_read sometimes returned early EOF.
63 * Revision 1.38 1995/12/04 17:59:21 adam
64 * More work on regular expression conversion.
66 * Revision 1.37 1995/12/04 14:22:27 adam
67 * Extra arg to recType_byName.
68 * Started work on new regular expression parsed input to
71 * Revision 1.36 1995/11/30 08:34:29 adam
72 * Started work on commit facility.
73 * Changed a few malloc/free to xmalloc/xfree.
75 * Revision 1.35 1995/11/28 14:26:21 adam
76 * Bug fix: recordId with constant wasn't right.
77 * Bug fix: recordId dictionary entry wasn't deleted when needed.
79 * Revision 1.34 1995/11/28 09:09:38 adam
80 * Zebra config renamed.
81 * Use setting 'recordId' to identify record now.
82 * Bug fix in recindex.c: rec_release_blocks was invokeded even
83 * though the blocks were already released.
84 * File traversal properly deletes records when needed.
86 * Revision 1.33 1995/11/27 09:56:20 adam
87 * Record info elements better enumerated. Internal store of records.
89 * Revision 1.32 1995/11/25 10:24:05 adam
90 * More record fields - they are enumerated now.
91 * New options: flagStoreData flagStoreKey.
93 * Revision 1.31 1995/11/24 11:31:35 adam
94 * Commands add & del read filenames from stdin if source directory is
96 * Match criteria supports 'constant' strings.
98 * Revision 1.30 1995/11/22 17:19:16 adam
99 * Record management uses the bfile system.
101 * Revision 1.29 1995/11/21 15:01:14 adam
102 * New general match criteria implemented.
103 * New feature: document groups.
105 * Revision 1.28 1995/11/21 09:20:30 adam
106 * Yet more work on record match.
108 * Revision 1.27 1995/11/20 16:59:45 adam
109 * New update method: the 'old' keys are saved for each records.
111 * Revision 1.26 1995/11/20 11:56:24 adam
112 * Work on new traversal.
114 * Revision 1.25 1995/11/16 15:34:54 adam
115 * Uses new record management system in both indexer and server.
117 * Revision 1.24 1995/11/15 19:13:08 adam
118 * Work on record management.
120 * Revision 1.23 1995/10/27 14:00:10 adam
121 * Implemented detection of database availability.
123 * Revision 1.22 1995/10/17 18:02:07 adam
124 * New feature: databases. Implemented as prefix to words in dictionary.
126 * Revision 1.21 1995/10/10 12:24:38 adam
127 * Temporary sort files are compressed.
129 * Revision 1.20 1995/10/06 13:52:05 adam
130 * Bug fixes. Handler may abort further scanning.
132 * Revision 1.19 1995/10/04 12:55:16 adam
133 * Bug fix in ranked search. Use=Any keys inserted.
135 * Revision 1.18 1995/10/04 09:37:08 quinn
138 * Revision 1.17 1995/10/03 14:28:57 adam
139 * Buffered read in extract works.
141 * Revision 1.16 1995/10/03 14:28:45 adam
142 * Work on more effecient read handler in extract.
144 * Revision 1.15 1995/10/02 15:42:53 adam
145 * Extract uses file descriptors instead of FILE pointers.
147 * Revision 1.14 1995/10/02 15:29:13 adam
148 * More logging in file_extract.
150 * Revision 1.13 1995/09/29 14:01:39 adam
153 * Revision 1.12 1995/09/28 14:22:56 adam
154 * Sort uses smaller temporary files.
156 * Revision 1.11 1995/09/28 12:10:31 adam
157 * Bug fixes. Field prefix used in queries.
159 * Revision 1.10 1995/09/28 09:19:41 adam
160 * xfree/xmalloc used everywhere.
161 * Extract/retrieve method seems to work for text records.
163 * Revision 1.9 1995/09/27 12:22:28 adam
164 * More work on extract in record control.
165 * Field name is not in isam keys but in prefix in dictionary words.
167 * Revision 1.8 1995/09/14 07:48:22 adam
168 * Record control management.
170 * Revision 1.7 1995/09/11 13:09:32 adam
171 * More work on relevance feedback.
173 * Revision 1.6 1995/09/08 14:52:27 adam
174 * Minor changes. Dictionary is lower case now.
176 * Revision 1.5 1995/09/06 16:11:16 adam
177 * Option: only one word key per file.
179 * Revision 1.4 1995/09/05 15:28:39 adam
180 * More work on search engine.
182 * Revision 1.3 1995/09/04 12:33:41 adam
183 * Various cleanup. YAZ util used instead.
185 * Revision 1.2 1995/09/04 09:10:34 adam
186 * More work on index add/del/update.
187 * Merge sort implemented.
188 * Initial work on z39 server.
190 * Revision 1.1 1995/09/01 14:06:35 adam
191 * Split of work into more files.
200 #include <alexutil.h>
204 #include "recindex.h"
206 static Dict matchDict;
208 static Records records = NULL;
210 static char **key_buf;
211 static size_t ptr_top;
213 static size_t key_buf_used;
214 static int key_file_no;
216 static int records_inserted = 0;
217 static int records_updated = 0;
218 static int records_deleted = 0;
220 void key_open (int mem)
224 key_buf = xmalloc (mem);
225 ptr_top = mem/sizeof(char*);
231 if (!(matchDict = dict_open (GMATCH_DICT, 50, 1)))
233 logf (LOG_FATAL, "dict_open fail of %s", GMATCH_DICT);
237 records = rec_open (1);
246 void encode_key_init (struct encode_info *i)
252 char *encode_key_int (int d, char *bp)
261 else if (d <= 4194303)
263 *bp++ = 128 + (d>>16);
264 *bp++ = (d>>8) & 255;
269 *bp++ = 192 + (d>>24);
270 *bp++ = (d>>16) & 255;
271 *bp++ = (d>>8) & 255;
277 void encode_key_write (char *k, struct encode_info *i, FILE *outf)
282 while ((*bp++ = *k++))
284 memcpy (&key, k+1, sizeof(struct it_key));
285 bp = encode_key_int ( (key.sysno - i->sysno) * 2 + *k, bp);
286 if (i->sysno != key.sysno)
288 i->sysno = key.sysno;
291 bp = encode_key_int (key.seqno - i->seqno, bp);
292 i->seqno = key.seqno;
293 if (fwrite (i->buf, bp - i->buf, 1, outf) != 1)
295 logf (LOG_FATAL|LOG_ERRNO, "fwrite");
300 void key_flush (void)
305 struct encode_info encode_info;
311 logf (LOG_LOG, "sorting section %d", key_file_no);
312 qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_qsort_compare);
313 sprintf (out_fname, TEMP_FNAME, key_file_no);
315 if (!(outf = fopen (out_fname, "w")))
317 logf (LOG_FATAL|LOG_ERRNO, "fopen (4) %s", out_fname);
320 logf (LOG_LOG, "writing section %d", key_file_no);
321 prevcp = cp = key_buf[ptr_top-ptr_i];
323 encode_key_init (&encode_info);
324 encode_key_write (cp, &encode_info, outf);
327 cp = key_buf[ptr_top-ptr_i];
328 if (strcmp (cp, prevcp))
330 encode_key_init (&encode_info);
331 encode_key_write (cp, &encode_info, outf);
335 encode_key_write (cp + strlen(cp), &encode_info, outf);
339 logf (LOG_FATAL|LOG_ERRNO, "fclose %s", out_fname);
342 logf (LOG_LOG, "finished section %d", key_file_no);
351 rec_close (&records);
352 dict_close (matchDict);
354 logf (LOG_LOG, "Records inserted %6d", records_inserted);
355 logf (LOG_LOG, "Records updated %6d", records_updated);
356 logf (LOG_LOG, "Records deleted %6d", records_deleted);
360 static void wordInit (RecWord *p)
364 p->which = Word_String;
375 static void addRecordKey (const RecWord *p)
383 if (reckeys.buf_used+1024 > reckeys.buf_max)
387 b = xmalloc (reckeys.buf_max += 128000);
388 if (reckeys.buf_used > 0)
389 memcpy (b, reckeys.buf, reckeys.buf_used);
393 dst = reckeys.buf + reckeys.buf_used;
395 attrSet = p->attrSet;
396 if (reckeys.buf_used > 0 && reckeys.prevAttrSet == attrSet)
399 reckeys.prevAttrSet = attrSet;
400 attrUse = p->attrUse;
401 if (reckeys.buf_used > 0 && reckeys.prevAttrUse == attrUse)
404 reckeys.prevAttrUse = attrUse;
413 memcpy (dst, &attrSet, sizeof(attrSet));
414 dst += sizeof(attrSet);
418 memcpy (dst, &attrUse, sizeof(attrUse));
419 dst += sizeof(attrUse);
421 for (i = 0; p->u.string[i]; i++)
422 *dst++ = p->u.string[i];
425 memcpy (dst, &p->seqno, sizeof(p->seqno));
426 dst += sizeof(p->seqno);
432 reckeys.buf_used = dst - reckeys.buf;
435 static void flushRecordKeys (SYSNO sysno, int cmd, struct recKeys *reckeys,
436 const char *databaseName)
441 while (off < reckeys->buf_used)
443 const char *src = reckeys->buf + off;
451 memcpy (&attrSet, src, sizeof(attrSet));
452 src += sizeof(attrSet);
456 memcpy (&attrUse, src, sizeof(attrUse));
457 src += sizeof(attrUse);
459 if (key_buf_used + 1024 > (ptr_top-ptr_i)*sizeof(char*))
462 key_buf[ptr_top-ptr_i] = (char*)key_buf + key_buf_used;
463 key_buf_used += index_word_prefix ((char*)key_buf + key_buf_used,
464 attrSet, attrUse, databaseName);
466 ((char*)key_buf) [key_buf_used++] = index_char_cvt (*src++);
468 ((char*)key_buf) [key_buf_used++] = '\0';
470 ((char*) key_buf)[key_buf_used++] = cmd;
472 memcpy (&key.seqno, src, sizeof(key.seqno));
473 src += sizeof(key.seqno);
475 memcpy ((char*)key_buf + key_buf_used, &key, sizeof(key));
476 key_buf_used += sizeof(key);
477 off = src - reckeys->buf;
479 assert (off == reckeys->buf_used);
482 static const char **searchRecordKey (struct recKeys *reckeys,
483 int attrSetS, int attrUseS)
485 static const char *ws[32];
490 for (i = 0; i<32; i++)
493 while (off < reckeys->buf_used)
495 const char *src = reckeys->buf + off;
501 memcpy (&attrSet, src, sizeof(attrSet));
502 src += sizeof(attrSet);
504 memcpy (&attrUse, src, sizeof(attrUse));
505 src += sizeof(attrUse);
511 memcpy (&seqno, src, sizeof(seqno));
512 src += sizeof(seqno);
515 logf (LOG_LOG, "(%d,%d) %d %s", attrSet, attrUse, seqno, wstart);
517 if (attrUseS == attrUse && attrSetS == attrSet)
524 woff = seqno - startSeq;
525 if (woff >= 0 && woff < 31)
529 off = src - reckeys->buf;
531 assert (off == reckeys->buf_used);
535 static void addRecordKeyAny (const RecWord *p)
537 if (p->attrSet != 1 || p->attrUse != 1016)
541 memcpy (&w, p, sizeof(w));
546 if (p->attrSet != -1)
550 #define FILE_READ_BUFSIZE 4096
551 struct file_read_info {
554 #if FILE_READ_BUFSIZE
561 static struct file_read_info *file_read_start (int fd)
563 struct file_read_info *fi = xmalloc (sizeof(*fi));
567 #if FILE_READ_BUFSIZE
569 fi->file_buf = xmalloc (FILE_READ_BUFSIZE);
570 fi->file_bufsize = read (fd, fi->file_buf, FILE_READ_BUFSIZE);
575 static void file_read_stop (struct file_read_info *fi)
578 #if FILE_READ_BUFSIZE
579 xfree (fi->file_buf);
585 static int file_read (void *handle, char *buf, size_t count)
587 struct file_read_info *p = handle;
589 #if FILE_READ_BUFSIZE
590 int l = p->file_bufsize - p->file_offset;
596 memcpy (buf, p->file_buf + p->file_offset, l);
598 if (count > FILE_READ_BUFSIZE)
600 if ((r = read (fd, buf + l, count)) == -1)
602 logf (LOG_FATAL|LOG_ERRNO, "read");
607 p->file_noread += l+r;
610 p->file_bufsize = r = read (fd, p->file_buf, FILE_READ_BUFSIZE);
613 logf (LOG_FATAL|LOG_ERRNO, "read");
619 memcpy (buf + l, p->file_buf, r);
620 p->file_noread += l+r;
625 p->file_offset = count;
626 memcpy (buf + l, p->file_buf, count - l);
627 p->file_noread += count;
631 memcpy (buf, p->file_buf + p->file_offset, count);
632 p->file_offset += count;
633 p->file_noread += count;
637 r = read (fd, buf, count);
644 static int atois (const char **s)
647 while ( (c=**s) >= '0' && c <= '9')
649 val = val*10 + c - '0';
655 static char *fileMatchStr (struct recKeys *reckeys, struct recordGroup *rGroup,
659 static char dstBuf[2048];
661 const char *s = spec;
662 static const char **w;
667 while (*s == ' ' || *s == '\t')
674 int attrSet, attrUse;
678 attrSet = atois (&s);
681 logf (LOG_WARN, "Missing , in match criteria %s in group %s",
682 spec, rGroup->groupName ? rGroup->groupName : "none");
686 attrUse = atois (&s);
687 w = searchRecordKey (reckeys, attrSet, attrUse);
692 for (i = 0; i<32; i++)
697 logf (LOG_WARN, "Missing ) in match criteria %s in group %s",
698 spec, rGroup->groupName ? rGroup->groupName : "none");
703 for (i = 0; i<32; i++)
704 if (matchFlag[i] && w[i])
716 logf (LOG_WARN, "Record didn't contain match"
717 " fields in (%d,%d)", attrSet, attrUse);
725 const char *spec_src = NULL;
726 const char *s1 = ++s;
727 while (*s1 && *s1 != ' ' && *s1 != '\t')
733 memcpy (special, s, spec_len);
734 special[spec_len] = '\0';
737 if (!strcmp (special, "group"))
738 spec_src = rGroup->groupName;
739 else if (!strcmp (special, "database"))
740 spec_src = rGroup->databaseName;
741 else if (!strcmp (special, "filename"))
743 else if (!strcmp (special, "type"))
744 spec_src = rGroup->recordType;
749 strcpy (dst, spec_src);
750 dst += strlen (spec_src);
753 else if (*s == '\"' || *s == '\'')
755 int stopMarker = *s++;
759 while (*s && *s != stopMarker)
762 tmpString[i++] = *s++;
767 strcpy (dst, tmpString);
768 dst += strlen (tmpString);
772 logf (LOG_WARN, "Syntax error in match criteria %s in group %s",
773 spec, rGroup->groupName ? rGroup->groupName : "none");
780 logf (LOG_WARN, "No match criteria for record %s in group %s",
781 fname, rGroup->groupName ? rGroup->groupName : "none");
787 struct recordLogInfo {
790 struct recordGroup *rGroup;
793 static void recordLogPreamble (int level, const char *msg, void *info)
795 struct recordLogInfo *p = info;
796 FILE *outf = log_file ();
801 fprintf (outf, "%s of ", p->op);
802 fprintf (outf, "%s type %s\n", p->rGroup->recordType, p->fname);
803 log_event_start (NULL, NULL);
806 static int recordExtract (SYSNO *sysno, const char *fname,
807 struct recordGroup *rGroup, int deleteFlag,
808 struct file_read_info *fi, RecType recType,
811 struct recExtractCtrl extractCtrl;
816 struct recordLogInfo logInfo;
818 logInfo.fname = fname;
820 logInfo.rGroup = rGroup;
821 log_event_start (recordLogPreamble, &logInfo);
825 /* we are going to read from a file, so prepare the extraction */
827 extractCtrl.subType = subType;
828 extractCtrl.init = wordInit;
829 extractCtrl.add = addRecordKeyAny;
831 reckeys.buf_used = 0;
832 reckeys.prevAttrUse = -1;
833 reckeys.prevAttrSet = -1;
834 extractCtrl.readf = file_read;
835 r = (*recType->extract)(&extractCtrl);
839 /* error occured during extraction ... */
840 logf (LOG_WARN, "Couldn't extract file %s, code %d", fname, r);
843 if (reckeys.buf_used == 0)
845 /* the extraction process returned no information - the record
847 logf (LOG_WARN, "Empty file %s", fname);
852 /* perform match if sysno not known and if match criteria is specified */
859 if (rGroup->recordId && *rGroup->recordId)
863 matchStr = fileMatchStr (&reckeys, rGroup, fname,
867 rinfo = dict_lookup (matchDict, matchStr);
869 memcpy (sysno, rinfo+1, sizeof(*sysno));
873 logf (LOG_WARN, "Bad match criteria");
884 logf (LOG_LOG, "Cannot delete new record");
888 if (rGroup->fileVerboseFlag)
889 logf (LOG_LOG, "add %s %s", rGroup->recordType, fname);
890 rec = rec_new (records);
895 dict_insert (matchDict, matchStr, sizeof(*sysno), sysno);
897 flushRecordKeys (*sysno, 1, &reckeys, rGroup->databaseName);
903 /* record already exists */
904 struct recKeys delkeys;
906 rec = rec_get (records, *sysno);
908 delkeys.buf_used = rec->size[recInfo_delKeys];
909 delkeys.buf = rec->info[recInfo_delKeys];
910 flushRecordKeys (*sysno, 0, &delkeys, rec->info[recInfo_databaseName]);
913 /* record going to be deleted */
914 logInfo.op = "delete";
915 if (!delkeys.buf_used)
917 logf (LOG_WARN, "cannot delete; storeKeys false");
921 if (rGroup->fileVerboseFlag)
922 logf (LOG_LOG, "delete %s %s", rGroup->recordType, fname);
925 dict_delete (matchDict, matchStr);
926 rec_del (records, &rec);
932 /* record going to be updated */
933 logInfo.op = "update";
934 if (!delkeys.buf_used)
936 logf (LOG_WARN, "cannot update; storeKeys false");
940 if (rGroup->fileVerboseFlag)
941 logf (LOG_LOG, "update %s %s", rGroup->recordType, fname);
942 flushRecordKeys (*sysno, 1, &reckeys, rGroup->databaseName);
947 /* update file type */
948 xfree (rec->info[recInfo_fileType]);
949 rec->info[recInfo_fileType] =
950 rec_strdup (rGroup->recordType, &rec->size[recInfo_fileType]);
952 /* update filename */
953 xfree (rec->info[recInfo_filename]);
954 rec->info[recInfo_filename] =
955 rec_strdup (fname, &rec->size[recInfo_filename]);
957 /* update delete keys */
958 xfree (rec->info[recInfo_delKeys]);
959 if (reckeys.buf_used > 0 && rGroup->flagStoreKeys == 1)
962 rec->size[recInfo_delKeys] = reckeys.buf_used;
963 rec->info[recInfo_delKeys] = reckeys.buf;
967 rec->info[recInfo_delKeys] = xmalloc (reckeys.buf_used);
968 rec->size[recInfo_delKeys] = reckeys.buf_used;
969 memcpy (rec->info[recInfo_delKeys], reckeys.buf,
970 rec->size[recInfo_delKeys]);
975 rec->info[recInfo_delKeys] = NULL;
976 rec->size[recInfo_delKeys] = 0;
979 /* update store data */
980 xfree (rec->info[recInfo_storeData]);
981 if (rGroup->flagStoreData == 1)
983 rec->size[recInfo_storeData] = fi->file_noread;
984 rec->info[recInfo_storeData] = xmalloc (fi->file_noread);
985 #if FILE_READ_BUFSIZE
986 if (fi->file_noread < FILE_READ_BUFSIZE)
987 memcpy (rec->info[recInfo_storeData], fi->file_buf,
992 if (lseek (fi->fd, 0L, SEEK_SET) < 0)
994 logf (LOG_ERRNO|LOG_FATAL, "seek to 0 in %s", fname);
997 if (read (fi->fd, rec->info[recInfo_storeData], fi->file_noread)
1000 logf (LOG_ERRNO|LOG_FATAL, "read %d bytes of %s",
1001 fi->file_noread, fname);
1008 rec->info[recInfo_storeData] = NULL;
1009 rec->size[recInfo_storeData] = 0;
1011 /* update database name */
1012 xfree (rec->info[recInfo_databaseName]);
1013 rec->info[recInfo_databaseName] =
1014 rec_strdup (rGroup->databaseName, &rec->size[recInfo_databaseName]);
1016 /* commit this record */
1017 rec_put (records, &rec);
1021 int fileExtract (SYSNO *sysno, const char *fname,
1022 const struct recordGroup *rGroupP, int deleteFlag)
1030 struct recordGroup rGroupM;
1031 struct recordGroup *rGroup = &rGroupM;
1032 struct file_read_info *fi;
1034 memcpy (rGroup, rGroupP, sizeof(*rGroupP));
1036 if (!rGroup->groupName || !*rGroup->groupName)
1039 sprintf (gprefix, "%s.", rGroup->groupName);
1041 logf (LOG_DEBUG, "fileExtract %s", fname);
1043 /* determine file extension */
1044 for (i = strlen(fname); --i >= 0; )
1045 if (fname[i] == '/')
1050 else if (fname[i] == '.')
1052 strcpy (ext, fname+i+1);
1055 /* determine file type - depending on extension */
1056 if (!rGroup->recordType)
1058 sprintf (ext_res, "%srecordType.%s", gprefix, ext);
1059 if (!(rGroup->recordType = res_get (common_resource, ext_res)))
1061 sprintf (ext_res, "%srecordType", gprefix);
1062 if (!(rGroup->recordType = res_get (common_resource, ext_res)))
1064 if (rGroup->fileVerboseFlag)
1065 logf (LOG_LOG, "? %s", fname);
1070 if (!rGroup->recordType)
1072 if (rGroup->fileVerboseFlag)
1073 logf (LOG_LOG, "? record %s", fname);
1076 if (!(recType = recType_byName (rGroup->recordType, subType)))
1078 logf (LOG_WARN, "No such record type: %s", rGroup->recordType);
1082 /* determine match criteria */
1083 if (!rGroup->recordId)
1085 sprintf (ext_res, "%srecordId.%s", gprefix, ext);
1086 rGroup->recordId = res_get (common_resource, ext_res);
1089 /* determine database name */
1090 if (!rGroup->databaseName)
1092 sprintf (ext_res, "%sdatabase.%s", gprefix, ext);
1093 if (!(rGroup->databaseName = res_get (common_resource, ext_res)))
1095 sprintf (ext_res, "%sdatabase", gprefix);
1096 rGroup->databaseName = res_get (common_resource, ext_res);
1099 if (!rGroup->databaseName)
1100 rGroup->databaseName = "Default";
1102 if (rGroup->flagStoreData == -1)
1105 sprintf (ext_res, "%sstoreData.%s", gprefix, ext);
1106 if (!(sval = res_get (common_resource, ext_res)))
1108 sprintf (ext_res, "%sstoreData", gprefix);
1109 sval = res_get (common_resource, ext_res);
1112 rGroup->flagStoreData = atoi (sval);
1114 if (rGroup->flagStoreData == -1)
1115 rGroup->flagStoreData = 0;
1117 if (rGroup->flagStoreKeys == -1)
1121 sprintf (ext_res, "%sstoreKeys.%s", gprefix, ext);
1122 if (!(sval = res_get (common_resource, ext_res)))
1124 sprintf (ext_res, "%sstoreKeys", gprefix);
1125 sval = res_get (common_resource, ext_res);
1128 rGroup->flagStoreKeys = atoi (sval);
1130 if (rGroup->flagStoreKeys == -1)
1131 rGroup->flagStoreKeys = 0;
1133 if (sysno && deleteFlag)
1137 if ((fd = open (fname, O_RDONLY)) == -1)
1139 logf (LOG_WARN|LOG_ERRNO, "open %s", fname);
1143 fi = file_read_start (fd);
1144 r = recordExtract (sysno, fname, rGroup, deleteFlag, fi, recType, subType);
1145 log_event_start (NULL, NULL);
1146 file_read_stop (fi);