summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/sysync/multifielditemtype.cpp15
-rwxr-xr-xsrc/sysync/syncitem.cpp12
-rwxr-xr-xsrc/sysync/syncitem.h3
3 files changed, 30 insertions, 0 deletions
diff --git a/src/sysync/multifielditemtype.cpp b/src/sysync/multifielditemtype.cpp
index d4e5e05..6f1d810 100755
--- a/src/sysync/multifielditemtype.cpp
+++ b/src/sysync/multifielditemtype.cpp
@@ -220,6 +220,20 @@ public:
}
}; // func_CompareFields
+
+ // string COMPARISONMODE()
+ // returns mode of comparison
+ static void func_ComparisonMode(TItemField *&aTermP, TScriptContext *aFuncContextP)
+ {
+ TMultiFieldItemType *mfitP = static_cast<TMultiFieldItemType *>(aFuncContextP->getCallerContext());
+ if (!mfitP->fFirstItemP) aTermP->unAssign(); // no comparison
+ else {
+ aTermP->setAsString(comparisonModeNames[mfitP->fEqMode]);
+ }
+ }; // func_CompareFields
+
+
+
#endif
@@ -325,6 +339,7 @@ const TBuiltInFuncDef DataTypeFuncDefs[] = {
{ "SETWINNINGCHANGED", TMFTypeFuncs::func_SetWinningChanged, fty_none, 1, param_IntArg },
{ "SETLOOSINGCHANGED", TMFTypeFuncs::func_SetLoosingChanged, fty_none, 1, param_IntArg },
{ "COMPAREFIELDS", TMFTypeFuncs::func_CompareFields, fty_integer, 0, NULL },
+ { "COMPARISONMODE", TMFTypeFuncs::func_ComparisonMode, fty_string, 0, NULL },
#endif
{ "SYNCOP", TMFTypeFuncs::func_SyncOp, fty_string, 0, NULL },
{ "REJECTITEM", TMFTypeFuncs::func_RejectItem, fty_none, 1, param_IntArg },
diff --git a/src/sysync/syncitem.cpp b/src/sysync/syncitem.cpp
index 1ee1c07..5cc2fb1 100755
--- a/src/sysync/syncitem.cpp
+++ b/src/sysync/syncitem.cpp
@@ -37,6 +37,18 @@ const char * const sysync::compareRelevanceNames[numEQmodes] = {
"n/a"
};
+
+const char * const sysync::comparisonModeNames[numEQmodes] = {
+ "all", // compare all fields, even irrelevant ones
+ "n/a", // n/a (scripted)
+ "conflict", // compare fields relevant for (normal sync) conflict detection
+ "slowsync", // compare fields relevant for slow sync match
+ "firstsync", // compare fields relevant for first time slow sync match (possibly relaxed comparison rules)
+ "age", // no test for equality, only for age (returns SYSYNC_NOT_COMPARABLE if age comparison not possible)
+};
+
+
+
/*
* Implementation of TSyncItem
*/
diff --git a/src/sysync/syncitem.h b/src/sysync/syncitem.h
index 83476bd..d805902 100755
--- a/src/sysync/syncitem.h
+++ b/src/sysync/syncitem.h
@@ -44,7 +44,10 @@ typedef enum { // RELEVANCE COMPARE MODE
// be modified
// Fields with eqm_none will also not be included in CRC calculations for detecting changes.
+// Names for TEqualityMode when used as field relevance
extern const char * const compareRelevanceNames[numEQmodes];
+ // Names for TEqualityMode when used as comparison mode
+extern const char * const comparisonModeNames[numEQmodes];
// merge options