资源简介
剑网3服务器的源代码,很全面,包含网关服务器,游戏服务器,中心服务器等,很有学习参考价值
代码片段和文件信息
//////////////////////////////////////////////////////////////////////////////////////
//
// FileName : KDBbase.cpp
// Version : 1.0
// Creater : Xia Yong
// Date : 2008-01-11 09:34:39
// Comment : 访问数据库
//////////////////////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “KDBbase.h“
#include “errmsg.h“
static const unsigned long MYSQL5_VERSION_ID = 50000; // MySQL 5 Version ID
BOOL MySQL_CheckCaseInsensitive(MYSQL* pHandle)
{
BOOL bResult = false;
int nRetCode = 0;
char szSQL[] = “show variables like \‘lower_case_table_names\‘“;
MYSQL_RES* pResultSet = NULL;
MYSQL_ROW Row = NULL;
unsigned uFieldCount = 0;
assert(pHandle);
nRetCode = MySQL_Query(pHandle szSQL);
KGLOG_PROCESS_ERROR(nRetCode);
pResultSet = mysql_store_result(pHandle);
KGLOG_PROCESS_ERROR(pResultSet);
uFieldCount = mysql_num_fields(pResultSet);
KGLOG_PROCESS_ERROR(uFieldCount == 2);
Row = mysql_fetch_row(pResultSet);
KGLOG_PROCESS_ERROR(Row);
nRetCode = strcmp(Row[1] “1“);
if (nRetCode)
{
KGLogPrintf(KGLOG_ERR “[DB] DB error lower_case_table_names --> 1\n“);
goto Exit0;
}
bResult = true;
Exit0:
if (pResultSet)
{
mysql_free_result(pResultSet);
pResultSet = NULL;
}
return bResult;
}
BOOL MySQL_CheckCharacterSet(MYSQL* pHandle)
{
BOOL bResult = false;
int nRetCode = 0;
char szSQL[] = “show variables like \‘character_set_database\‘“;
MYSQL_RES* pResultSet = NULL;
MYSQL_ROW Row = NULL;
unsigned uFieldCount = 0;
assert(pHandle);
// get database character set
nRetCode = MySQL_Query(pHandle szSQL);
KGLOG_PROCESS_ERROR(nRetCode);
pResultSet = mysql_store_result(pHandle);
KGLOG_PROCESS_ERROR(pResultSet);
uFieldCount = mysql_num_fields(pResultSet);
KGLOG_PROCESS_ERROR(uFieldCount == 2);
Row = mysql_fetch_row(pResultSet);
KGLOG_PROCESS_ERROR(Row);
KGLOG_PROCESS_ERROR(Row[1]);
nRetCode = mysql_set_character_set(pHandle Row[1]);
KGLOG_PROCESS_ERROR(nRetCode == 0);
bResult = true;
Exit0:
if (pResultSet)
{
mysql_free_result(pResultSet);
pResultSet = NULL;
}
return bResult;
}
MYSQL* MySQL_Connect(
const char cszDBAddr[] const char cszDBName[] int nPort
const char cszUserName[] const char cszPassword[]
)
{
MYSQL* pResult = NULL;
int nRetCode = false;
MYSQL* pDBHandle = NULL;
MYSQL* pTmpHandle = NULL;
my_bool bReconnectFlag = 0;
unsigned long ulMy
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 22 2010-01-08 09:06 Server\JX3ServerMergeTool\CVS\Entries
文件 28 2010-01-08 09:06 Server\JX3ServerMergeTool\CVS\Entries.Extra
文件 46 2010-01-08 09:06 Server\JX3ServerMergeTool\CVS\Entries.Extra.Old
文件 37 2010-01-08 09:06 Server\JX3ServerMergeTool\CVS\Entries.Old
文件 41 2009-12-16 06:13 Server\JX3ServerMergeTool\CVS\Repository
文件 61 2009-12-16 06:13 Server\JX3ServerMergeTool\CVS\Root
文件 25 2010-01-08 09:05 Server\JX3ServerMergeTool\CVS\Tag
文件 75 2010-01-08 09:05 Server\JX3ServerMergeTool\doc\CVS\Entries
文件 32 2010-01-08 09:05 Server\JX3ServerMergeTool\doc\CVS\Entries.Extra
文件 32 2010-01-07 06:04 Server\JX3ServerMergeTool\doc\CVS\Entries.Extra.Old
文件 75 2010-01-07 06:04 Server\JX3ServerMergeTool\doc\CVS\Entries.Old
文件 45 2009-12-16 06:13 Server\JX3ServerMergeTool\doc\CVS\Repository
文件 61 2009-12-16 06:13 Server\JX3ServerMergeTool\doc\CVS\Root
文件 25 2010-01-08 09:05 Server\JX3ServerMergeTool\doc\CVS\Tag
文件 60416 2009-11-25 11:41 Server\JX3ServerMergeTool\doc\合服策略.doc
文件 1220 2010-01-08 09:05 Server\JX3ServerMergeTool\src\CVS\Entries
文件 592 2010-01-08 09:05 Server\JX3ServerMergeTool\src\CVS\Entries.Extra
文件 592 2010-01-07 06:04 Server\JX3ServerMergeTool\src\CVS\Entries.Extra.Old
文件 1220 2010-01-07 06:04 Server\JX3ServerMergeTool\src\CVS\Entries.Old
文件 45 2009-12-16 06:13 Server\JX3ServerMergeTool\src\CVS\Repository
文件 61 2009-12-16 06:13 Server\JX3ServerMergeTool\src\CVS\Root
文件 25 2010-01-08 09:05 Server\JX3ServerMergeTool\src\CVS\Tag
文件 5959 2010-01-06 06:04 Server\JX3ServerMergeTool\src\JX3ServerMergeTool.vcproj
文件 9079 2009-12-08 14:14 Server\JX3ServerMergeTool\src\KDBba
文件 3437 2009-12-22 06:06 Server\JX3ServerMergeTool\src\KDBba
文件 1152 2009-11-24 18:06 Server\JX3ServerMergeTool\src\KFellowshipDef.h
文件 1281 2009-12-22 06:06 Server\JX3ServerMergeTool\src\KMailDef.h
文件 2936 2009-12-18 06:06 Server\JX3ServerMergeTool\src\KMergeSettings.cpp
文件 636 2009-12-14 18:08 Server\JX3ServerMergeTool\src\KMergeSettings.h
文件 58644 2010-01-08 09:05 Server\JX3ServerMergeTool\src\KMergeTool.cpp
............此处省略770个文件信息
- 上一篇:企业应用架构模式(PDF带书签索引版)
- 下一篇:信号检测与估计赵树杰赵建勋课件素材
评论
共有 条评论