added force_update option for update_record, delete_record calls, to hopefully a
authorpop <pop>
Wed, 12 Mar 2003 17:11:23 +0000 (17:11 +0000)
committerpop <pop>
Wed, 12 Mar 2003 17:11:23 +0000 (17:11 +0000)
llow multiple changes of a record within one transaction. Stupid, idn't it?

index/extract.c
index/index.h
index/zebraapi.c

index a54bb10..e431453 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: extract.c,v 1.141 2003-03-05 00:08:04 adam Exp $
+/* $Id: extract.c,v 1.142 2003-03-12 17:11:23 pop Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
    Index Data Aps
 
@@ -917,7 +917,8 @@ int extract_rec_in_mem (ZebraHandle zh, const char *recordType,
                                 recordType,
                                 sysno,
                                 match_criteria,
-                                "<no file>"));
+                                "<no file>",
+                                0));
 }
 /*
   If sysno is provided, then it's used to identify the reocord.
@@ -933,7 +934,8 @@ int bufferExtractRecord (ZebraHandle zh,
                         const char *recordType,
                         int *sysno,
                         const char *match_criteria,
-                        const char *fname)
+                        const char *fname,
+                        int force_update)
 
 {
     RecordAttr *recordAttr;
@@ -1104,16 +1106,19 @@ int bufferExtractRecord (ZebraHandle zh,
        
        recordAttr = rec_init_attr (zh->reg->zei, rec);
 
-       if (recordAttr->runNumber ==
-           zebraExplain_runNumberIncrement (zh->reg->zei, 0))
-       {
-           logf (LOG_LOG, "skipped %s %s %ld", recordType,
-                 fname, (long) recordOffset);
-           extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys);
-           rec_rm (&rec);
-            logRecord(zh);
-           return 1;
+       if (!force_update) {
+         if (recordAttr->runNumber ==
+             zebraExplain_runNumberIncrement (zh->reg->zei, 0))
+           {
+             logf (LOG_LOG, "skipped %s %s %ld", recordType,
+                   fname, (long) recordOffset);
+             extract_flushSortKeys (zh, *sysno, -1, &zh->reg->sortKeys);
+             rec_rm (&rec);
+             logRecord(zh);
+             return 1;
+           }
        }
+
         delkeys.buf_used = rec->size[recInfo_delKeys];
        delkeys.buf = rec->info[recInfo_delKeys];
 
index 502be5a..56e7292 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: index.h,v 1.95 2003-03-06 11:58:08 adam Exp $
+/* $Id: index.h,v 1.96 2003-03-12 17:11:23 pop Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -420,7 +420,8 @@ int bufferExtractRecord (ZebraHandle zh,
                         const char *recordType,
                         int *sysno,
                         const char *match_criteria,
-                        const char *fname);
+                        const char *fname,
+                        int force_update);
 
 int extract_rec_in_mem (ZebraHandle zh, const char *recordType,
                         const char *buf, size_t buf_size,
index ab5cf26..7ce50b9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.91 2003-03-06 11:58:08 adam Exp $
+/* $Id: zebraapi.c,v 1.92 2003-03-12 17:11:23 pop Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
    Index Data Aps
 
@@ -1780,7 +1780,8 @@ int zebra_update_record (ZebraHandle zh,
                         struct recordGroup *rGroup,
                         const char *recordType,
                         int sysno, const char *match, const char *fname,
-                        const char *buf, int buf_size)
+                        const char *buf, int buf_size,
+                        int force_update)
 
 {
     int res;
@@ -1793,7 +1794,8 @@ int zebra_update_record (ZebraHandle zh,
                             0, // test_mode,
                             recordType,
                             &sysno,   
-                            match, fname);     
+                            match, fname,
+                            force_update);     
     zebra_end_trans(zh); 
     return sysno; 
 }
@@ -1802,7 +1804,8 @@ int zebra_delete_record (ZebraHandle zh,
                         struct recordGroup *rGroup, 
                         const char *recordType,
                         int sysno, const char *match, const char *fname,
-                        const char *buf, int buf_size)
+                        const char *buf, int buf_size,
+                        int force_update) 
 {
     int res;
 
@@ -1814,7 +1817,8 @@ int zebra_delete_record (ZebraHandle zh,
                             0, // test_mode, 
                             recordType,
                             &sysno,
-                            match,fname);    
+                            match,fname,
+                            force_update);    
     zebra_end_trans(zh);
     return sysno;   
 }