-/* $Id: zebraapi.c,v 1.90 2003-03-05 00:08:04 adam Exp $
+/* $Id: zebraapi.c,v 1.94 2003-03-25 19:56:01 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
}
rpn_scan (zh, stream, zapt, attributeset,
zh->num_basenames, zh->basenames, position,
- num_entries, entries, is_partial);
+ num_entries, entries, is_partial, 0, 0);
zebra_end_read (zh);
}
repositoryShow (zh);
}
-int zebra_commit (ZebraHandle zh)
+static int zebra_commit_ex (ZebraHandle zh, int clean_only)
{
int seqno;
char val;
bf_cache (bfs, rval);
if (bf_commitExists (bfs))
{
- zebra_set_state (zh, 'c', seqno);
-
- logf (LOG_LOG, "commit start");
- bf_commitExec (bfs);
+ if (clean_only)
+ zebra_set_state (zh, 'd', seqno);
+ else
+ {
+ zebra_set_state (zh, 'c', seqno);
+
+ logf (LOG_LOG, "commit start");
+ bf_commitExec (bfs);
#ifndef WIN32
- sync ();
+ sync ();
#endif
+ }
logf (LOG_LOG, "commit clean");
bf_commitClean (bfs, rval);
seqno++;
return 0;
}
+int zebra_clean (ZebraHandle zh)
+{
+ zebra_commit_ex(zh, 1);
+}
+
+int zebra_commit (ZebraHandle zh)
+{
+ zebra_commit_ex(zh, 0);
+}
+
int zebra_init (ZebraHandle zh)
{
const char *rval;
If not, and a record is provided, then sysno is got from there
*/
+int zebra_insert_record (ZebraHandle zh,
+ struct recordGroup *rGroup,
+ const char *recordType,
+ int sysno, const char *match, const char *fname,
+ const char *buf, int buf_size,
+ int force_update) // This one is ignored
+
+{
+ int res;
+
+ if (buf_size < 1) buf_size = strlen(buf);
+
+ zebra_begin_trans(zh, 1);
+ res=bufferExtractRecord (zh, buf, buf_size, rGroup,
+ 0, // delete_flag
+ 0, // test_mode,
+ recordType,
+ &sysno,
+ match, fname,
+ force_update,
+ 0); // allow_update
+ zebra_end_trans(zh);
+ if (res < 0) return (res);
+ return sysno;
+}
+
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;
0, // test_mode,
recordType,
&sysno,
- match, fname);
+ match, fname,
+ force_update,
+ 1); // allow_update
zebra_end_trans(zh);
return sysno;
}
+
+
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;
0, // test_mode,
recordType,
&sysno,
- match,fname);
+ match,fname,
+ force_update,
+ 1); // allow_update
zebra_end_trans(zh);
return sysno;
}