-/* $Id: zebraapi.c,v 1.89 2003-03-04 23:48:55 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+/* $Id: zebraapi.c,v 1.96 2003-03-26 16:41:48 adam Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
This file is part of the Zebra server.
zebraRankInstall (reg, rank1_class);
zebraRankInstall (reg, rankzv_class);
+ zebraRankInstall (reg, rankliv_class);
recordCompression = res_get_def (res, "recordCompression", "none");
if (!strcmp (recordCompression, "none"))
if (zebra_begin_read (zh))
return;
+
+ zebra_livcode_transform(zh, query);
+
resultSetAddRPN (zh, decode, stream, query,
zh->num_basenames, zh->basenames, setname);
}
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)
+{
+ return zebra_commit_ex(zh, 1);
+}
+
+int zebra_commit (ZebraHandle zh)
+{
+ return zebra_commit_ex(zh, 0);
+}
+
int zebra_init (ZebraHandle zh)
{
const char *rval;
}
const char *zebra_get_resource(ZebraHandle zh,
- const char *name, const char *defaultvalue)
+ const char *name, const char *defaultvalue)
{
ASSERTZH;
zh->errCode=0;
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;
}