summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2011-09-12 20:30:24 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2011-09-15 12:26:32 +0200
commita23db52be49c2494e02555f094fb7608a97c7754 (patch)
tree302253c9056fe515250b242563ee000ec5777bae
parent3f6caaeec863be3c00120ba816176ee8b717a3ca (diff)
plugin API: support new DB_DataReplaced/Merged/Conflict status codes
For these codes the local ID must be passed through to the caller. For DB_Conflict no real changes were made in the plugin, so after write scripts and blog writing are not invoked.
-rwxr-xr-xsrc/DB_interfaces/api_db/pluginapids.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/DB_interfaces/api_db/pluginapids.cpp b/src/DB_interfaces/api_db/pluginapids.cpp
index 54a63ad..e2b5a9b 100755
--- a/src/DB_interfaces/api_db/pluginapids.cpp
+++ b/src/DB_interfaces/api_db/pluginapids.cpp
@@ -1325,23 +1325,27 @@ localstatus TPluginApiDS::apiAddItem(TMultiFieldItem &aItem, string &aLocalID)
#endif
// now check result
if (dberr==LOCERR_OK ||
+ dberr==DB_Conflict ||
+ dberr==DB_DataReplaced ||
dberr==DB_DataMerged) {
// save new ID
aLocalID = itemAndParentID.item.c_str();
aItem.setLocalID(aLocalID.c_str()); // make sure item itself has correct ID as well
- // now write all the BLOBs
- writeBlobs(false,aItem,0);
- #ifdef SCRIPT_SUPPORT
- // process overall afterwrite script
- fWriting=true;
- fInserting=true;
- fDeleting=false;
- fPluginAgentP->fScriptContextDatastore=this;
- if (!TScriptContext::execute(fScriptContextP,fPluginDSConfigP->fFieldMappings.fAfterWriteScript,fPluginDSConfigP->getDSFuncTableP(),fPluginAgentP,&aItem,true)) {
- PDEBUGPRINTFX(DBG_ERROR,("<afterwritescript> failed"));
- dberr = LOCERR_WRONGUSAGE;
+ if (dberr!=DB_Conflict) {
+ // now write all the BLOBs
+ writeBlobs(false,aItem,0);
+ #ifdef SCRIPT_SUPPORT
+ // process overall afterwrite script
+ fWriting=true;
+ fInserting=true;
+ fDeleting=false;
+ fPluginAgentP->fScriptContextDatastore=this;
+ if (!TScriptContext::execute(fScriptContextP,fPluginDSConfigP->fFieldMappings.fAfterWriteScript,fPluginDSConfigP->getDSFuncTableP(),fPluginAgentP,&aItem,true)) {
+ PDEBUGPRINTFX(DBG_ERROR,("<afterwritescript> failed"));
+ dberr = LOCERR_WRONGUSAGE;
+ }
+ #endif
}
- #endif
}
// return status
return dberr;