[GME-commit] GMESRC/GME/Gme GMEApp.cpp,1.118,1.119

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Tue Jul 20 12:01:42 CDT 2004


Update of /var/lib/gme/GMESRC/GME/Gme
In directory braindrain:/tmp/cvs-serv9303/GME/Gme

Modified Files:
	GMEApp.cpp 
Log Message:
Version based paradigm registration

CVS User: volgy

Index: GMEApp.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/GMEApp.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -C2 -d -r1.118 -r1.119
*** GMEApp.cpp	19 Jul 2004 07:00:59 -0000	1.118
--- GMEApp.cpp	20 Jul 2004 16:01:34 -0000	1.119
***************
*** 867,870 ****
--- 867,880 ----
  }
  
+ static int versioncmp(CComBSTR &qVer, CComBSTR &pVer) {
+ 	CString q(qVer);
+ 	CString p(pVer);
+ 
+ 	if ((!p.IsEmpty()) && (!q.IsEmpty())) {
+ 		return p.Compare(q);
+ 	}
+ 	return 1;
+ }
+ 
  
  bool DiagnoseParadigm(CString metaname, bool syscheck = false) {
***************
*** 976,983 ****
  		if(hr != S_OK) {
  			CComBSTR parn;
  			long version;
  			CComVariant parg;
  			VARIANT_BOOL ro_mode;
! 			if(S_OK != mgaProject->QueryProjectInfo(PutInBstr(conn), &version, &parn, &parg, &ro_mode)) {
  				AfxMessageBox("Cannot query project information. Possible cause: missing/corrupt project file or database");
  				COMTHROW(hr);
--- 986,994 ----
  		if(hr != S_OK) {
  			CComBSTR parn;
+ 			CComBSTR parv;
  			long version;
  			CComVariant parg;
  			VARIANT_BOOL ro_mode;
! 			if(S_OK != mgaProject->QueryProjectInfo(PutInBstr(conn), &version, &parn, &parv, &parg, &ro_mode)) {
  				AfxMessageBox("Cannot query project information. Possible cause: missing/corrupt project file or database");
  				COMTHROW(hr);
***************
*** 1041,1052 ****
  			CComVariant g, g2;
  			CComBSTR pname; 
  			{
- 				CComPtr<IMgaMetaProject> mp;
  				CComPtr<IMgaTerritory> t;
  				COMTHROW(mgaProject->CreateTerritory(NULL, &t, NULL));
  				COMTHROW(mgaProject->BeginTransaction(t, TRANSACTION_READ_ONLY));
! 				COMTHROW(mgaProject->get_RootMeta(&mp) );
! 				COMTHROW(mp->get_Name(&pname));
  				COMTHROW(mgaProject->get_MetaGUID(&g));
  				// COMTHROW(mgaProject->AbortTransaction()); PETER: Why abort ?
  				COMTHROW(mgaProject->CommitTransaction());
--- 1052,1063 ----
  			CComVariant g, g2;
  			CComBSTR pname; 
+ 			CComBSTR pver, pver2;
  			{
  				CComPtr<IMgaTerritory> t;
  				COMTHROW(mgaProject->CreateTerritory(NULL, &t, NULL));
  				COMTHROW(mgaProject->BeginTransaction(t, TRANSACTION_READ_ONLY));
! 				COMTHROW(mgaProject->get_MetaName(&pname));
  				COMTHROW(mgaProject->get_MetaGUID(&g));
+ 				COMTHROW(mgaProject->get_MetaVersion(&pver));
  				// COMTHROW(mgaProject->AbortTransaction()); PETER: Why abort ?
  				COMTHROW(mgaProject->CommitTransaction());
***************
*** 1055,1060 ****
  				CComBSTR connstr;
  				COMTHROW(mgareg->QueryParadigm(pname, &connstr, &g2, REGACCESS_PRIORITY));
  			}
! 			if(guidcmp(g, g2)) {
  				int answer = AfxMessageBox("The paradigm used to open this file is not the current version\n"
  								"Do you want to upgrade to the current paradigm?"	,MB_YESNO);
--- 1066,1072 ----
  				CComBSTR connstr;
  				COMTHROW(mgareg->QueryParadigm(pname, &connstr, &g2, REGACCESS_PRIORITY));
+ 				mgareg->VersionFromGUID(pname, g2, &pver2, REGACCESS_PRIORITY);
  			}
! 			if(guidcmp(g, g2) && versioncmp(pver, pver2)) {
  				int answer = AfxMessageBox("The paradigm used to open this file is not the current version\n"
  								"Do you want to upgrade to the current paradigm?"	,MB_YESNO);



More information about the GME-commit mailing list