123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- #include "stdafx.h"
- #include "lyfzUpgrade.h"
- #include "Executor.h"
- #include "my32.h"
- #include "SQLStatementImpl.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- typedef struct __STVERSION__
- {
- int nVersion;
- CString strVersion;
- }STVersion, *pSTVersion;
- STVersion g_stVersion[6] =
- {
- { 0, _T("儿童座席版") },
- { 1, _T("婚纱座席版") },
- { 2, _T("儿童企业版") },
- { 3, _T("婚纱企业版") },
- { 4, _T("儿童全能版") },
- { 5, _T("婚纱全能版") }
- };
- CWinApp theApp;
- using namespace std;
- int MyTest()
- {
- FindAndCloseProcess(_T("E:\\lyfzbin\\Services\\lyfzServices.exe"));
- return 0;
- CSQLStatementImpl::GetInstancePtr()->ReSetKind(_T("dindan"), _T("where id='120456465465'"), KIND_UPDATE, 10);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction1"),1);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction2"),2);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction3"),3);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction4"),4);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction5"), 5);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction6"), 6);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction7"), 7);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("satisfaction8"), 8);
- CSQLStatementImpl::GetInstancePtr()->AddElement(_T("bz5"), _T("22333"));
- CString sql = CSQLStatementImpl::GetInstancePtr()->ReturnSQL();
- return 0;
- }
- int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
- {
- int nRetCode = 0;
-
-
-
- GetProductVersion((HMODULE)NULL, g_arrFileVersion);
-
- GetDebugPriv();
-
- if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
- {
- _tprintf(_T("错误: MFC 初始化失败\n"));
- nRetCode = 1;
- }
- else
- {
- HANDLE hObject = CreateMutex(NULL, FALSE, _T("lyfzUpgradeRuning"));
- if (GetLastError() == ERROR_ALREADY_EXISTS)
- {
- #ifdef USE_CONSOLE
- AfxMessageBox(_T("升级程序已启动!"));
- #else
- _tprintf(_T("升级程序已启动\n"));
- #endif
- return false;
- }
-
- if (GetIniInfo() == -1)
- {
- #ifdef USE_CONSOLE
- AfxMessageBox(_T("没有找到ServiceInof.ini文件,请修改默认生成的ServiceInof.ini后重新更新!"));
- #else
- _tprintf(_T("没有找到ServiceInof.ini文件,请修改默认生成的ServiceInof.ini后重新更新\n"));
- #endif
- TCHAR szExecuteFile[MAX_PATH] = _T("");
- _stprintf_s(szExecuteFile, _T("%sServiceInfo.ini"), g_ModulePath);
- CExecutor::UpdateFile(ServiceInfo, _T("INI"), szExecuteFile);
- return -1;
- }
-
-
- #ifdef USE_CONSOLE
-
- #else
- _tprintf(_T("升级完成后会提示 '升级成功' 如没有提示,请重启电脑后再次安装!\n"));
- #endif
- TCHAR szDealFile[MAX_PATH] = _T("");
- _stprintf_s(szDealFile, _T("%s\\日志.txt"), g_ModulePath);
- lyfzCopyFileEx(szDealFile,szDealFile,TRUE);
- ::DeleteFile(szDealFile);
- _stprintf_s(szDealFile, _T("%s\\升级包日志.txt"), g_ModulePath);
- ::DeleteFile(szDealFile);
-
- CExecutor tagExecutor;
- #if 1
- if (tagExecutor.ConnectDatabase() == -1)
- return 0;
- #endif
- tagExecutor.InitMaster();
-
-
-
- if (tagExecutor.UpgradeExe(FALSE) == -1)
- return 0;
-
-
- tagExecutor.DisConnectDatabase();
- }
- return nRetCode;
- }
|