📄 main.cpp
字号:
#include "stdafx.h"
/*#define _USING_ODBC ///< ODBC荤侩
#include <windows.h>
#include <oledb.h>
#include <Linkedlist.h>
#include <CriticalSection.h>
#include <SafeMemoryPoolFactory.h>
#include <MemoryPoolFactory.h>
#pragma comment( lib, "ws2_32.lib" )
#include <windows.h>
#include <Linkedlist.h>
#include <CriticalSection.h>
#include <oledb.h>
#define _USING_ODBC ///< ODBC荤侩
#ifdef _DEBUG
#pragma comment( lib, "Network_d.lib" )
#pragma comment( lib, "Utility_d.lib" )
#pragma comment( lib, "SolarDatabase_d.lib" )
#pragma comment( lib, "ProgramCommon_d.lib" )
#else
#pragma comment( lib, "Network.lib" )
#pragma comment( lib, "Utility.lib" )
#pragma comment( lib, "SolarDatabase.lib" )
#pragma comment( lib, "ProgramCommon.lib" )
#endif
*/
#include <stdio.h>
#include <Stackwalker.h>
#include "DBProxyServer.h"
#include <SUNConsole.h>
#include <SolarDump.h>
#include "ServiceApp.h"
SUNConsole g_SUNConsole;
ISolarConsole * g_pIConsole = NULL;
extern void CallBackCommand( char * szMessage );
class DBProxyServiceApp : public ServiceApp
{
public :
DBProxyServiceApp(const char* pServiceName)
: ServiceApp(pServiceName)
{
}
virtual VOID Update()
{
g_DBProxyServer.Run();
}
virtual VOID OnStop()
{
g_DBProxyServer.Release();
// 辑滚 辆丰
DISPMSG( "Server is terminated...\n" );
g_SUNConsole.Release();
}
};
__DECLARE_SERVICE( DBProxyServiceApp, "DBProxyServer" );
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
StartMemoryLeakCheck();
//BreakPointOnMemoryLeak(148);
SolarDump dp;
BOOL bConsoleMode = (strstr( lpCmdLine, "service" ) == NULL);
/*
SolarDatabaseDesc desc_;
//desc.DataBaseModuleType = DBCInterfaceType_OLEDB;
desc_.DataBaseModuleType = DBCInterfaceType_ODBC;
desc_.dwQueryPoolSize = 2000;
desc_.wQueryProcessorNum = 1;
desc_.pszDatabaseIP = "10.1.48.38";
desc_.pszDatabaseName = "SUNOnline";
desc_.pszUserName = "sa";
desc_.pszUserPassword = "xodidtjqjd";
desc_.fnErrorMessage = NULL;
desc_.fnQueryResult = NULL;
SolarDatabase * db = new SolarDatabase;
db->Initialize( desc_ );
db->Release();
delete db;*/
#ifdef _USING_SIMPLE_CONSOLE
if( !g_SUNConsole.Init( eSIMPLE_CONSOLE ) )
#else
if( !g_SUNConsole.Init( eCOMPLEX_CONSOLE ) )
#endif
{
ASSERT( !"Solar console Initialization failed!" );
return 0;
}
// 辑滚 檬扁拳
if( !g_DBProxyServer.Init() )
{
DISPMSG( "Server initialization failed!\n" );
system( "pause" );
return 0;
}
DISPMSG( "====================================================\n" );
DISPMSG( " SUN Online DB Proxy Server Initialization Complete.\n" );
DISPMSG( "====================================================\n" );
// 辑滚 矫累
if (bConsoleMode)
{
g_DBProxyServer.Run();
g_DBProxyServer.Release();
// 辑滚 辆丰
DISPMSG( "Server is terminated...\n" );
g_SUNConsole.Release();
}
else
{
DISPMSG( "<<<<< Service Mode >>>>>\n" );
__START_SERVICE( DBProxyServiceApp );
}
#ifdef _DEBUG
//DeInitAllocCheck();//Memory Leak Check End
#endif
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -