[commit] r2533 - trunk/SDK/BON/Wizard/Templates/1033

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Sep 17 12:35:34 CDT 2014


Author: ksmyth
Date: Wed Sep 17 12:35:34 2014
New Revision: 2533

Log:
Interpreter wizard: allow raw COM components to be called while within a transaction (e.g. from another interpeter)

Modified:
   trunk/SDK/BON/Wizard/Templates/1033/RawComponent.cpp

Modified: trunk/SDK/BON/Wizard/Templates/1033/RawComponent.cpp
==============================================================================
--- trunk/SDK/BON/Wizard/Templates/1033/RawComponent.cpp	Wed Sep 17 12:35:29 2014	(r2532)
+++ trunk/SDK/BON/Wizard/Templates/1033/RawComponent.cpp	Wed Sep 17 12:35:34 2014	(r2533)
@@ -59,8 +59,12 @@
 	COMTRY {
 		_bstr_t focusname = "<nothing>";
 		IMgaTerritoryPtr terr;
-		project->CreateTerritory(NULL, &terr, NULL);
-		project->BeginTransaction(terr, TRANSACTION_GENERAL);
+		bool invokeExStartedATransaction = false;
+		if (!(project->ProjectStatus & 8))
+		{
+			terr = project->BeginTransactionInNewTerr(TRANSACTION_NON_NESTED); // could also use TRANSACTION_GENERAL
+			invokeExStartedATransaction = true;
+		}
 		try {
 			if (currentobj)
 				focusname = currentobj->Name;
@@ -68,9 +72,14 @@
 			Console::Out::WriteLine("Interpreter started...");
 			AfxMessageBox(_T("RAW Com Component --- Plugin!!!! Sample (project: ") + project->Name +
 						_T(", focus: ") + focusname);
-			project->CommitTransaction();
+			if (invokeExStartedATransaction)
+				project->CommitTransaction();
 			Console::Out::WriteLine(_T("Interpreter completed..."));
-		}	catch(...) { project->AbortTransaction(); throw; }
+		} catch(...) {
+			if (invokeExStartedATransaction)
+				project->AbortTransaction();
+			throw;
+		}
 	} COMCATCH(;);
 }
 


More information about the gme-commit mailing list