Skip to content

Commit a27f04e

Browse files
committed
modify:move database and p2xp module to root dir
modify:mysql function name delete:sqlite database for future distributed storage
1 parent 2f52198 commit a27f04e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+686
-1921
lines changed

XEngine_Source/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ FLAGS = RELEASE=$(RELEASE)
55

66
THIRD_JSONCPP_PATH = ./XEngine_ThirdPart/jsoncpp
77

8-
STORAGE_SQL_PATH = ./XEngine_StorageComponents/XStorage_SQLPacket
9-
STORAGE_P2XP_PATH = ./XEngine_StorageComponents/XStorage_P2XPPeer
8+
STORAGE_SQL_PATH = ./StorageModule_Database
9+
STORAGE_P2XP_PATH = ./StorageModule_P2XPPeer
1010

1111
BASE_CONFIG_PATH = ./StorageModule_Config
1212
BASE_SESSION_PATH = ./StorageModule_Session
@@ -16,7 +16,7 @@ BASE_PROTOCOL_PATH = ./StorageModule_Protocol
1616
APPSERVICE_STORAGE_PATH = ./XEngine_StorageApp
1717

1818
NETENGINE_LIB = libjsoncpp.so \
19-
libXStorage_SQLPacket.so libXStorage_P2XPPeer.so \
19+
libStorageModule_Database.so libStorageModule_P2XPPeer.so \
2020
libStorageModule_Config.so libStorageModule_Session.so libStorageModule_APIHelp.so libStorageModule_Protocol.so \
2121
XEngine_StorageApp.exe
2222

@@ -26,9 +26,9 @@ MakeAll:$(NETENGINE_LIB)
2626
libjsoncpp.so:
2727
make -C $(THIRD_JSONCPP_PATH) $(FLAGS)
2828

29-
libXStorage_SQLPacket.so:
29+
libStorageModule_Database.so:
3030
make -C $(STORAGE_SQL_PATH) $(FLAGS)
31-
libXStorage_P2XPPeer.so:
31+
libStorageModule_P2XPPeer.so:
3232
make -C $(STORAGE_P2XP_PATH) $(FLAGS)
3333

3434
libStorageModule_Config.so:

XEngine_Source/StorageModule_APIHelp/pch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using namespace std;
4040
#include <XEngine_Include/XEngine_RfcComponents/HttpServer_Error.h>
4141
#include "../XStorage_Protocol.h"
4242
#include "../StorageModule_Config/Config_Define.h"
43-
#include "../XEngine_StorageComponents/XStorage_SQLPacket/SQLPacket_Define.h"
43+
#include "../StorageModule_Database/Database_Define.h"
4444
#include "APIHelp_Define.h"
4545
#include "APIHelp_Error.h"
4646
/********************************************************************

XEngine_Source/StorageModule_Config/Config_Define.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ typedef struct tag_XEngine_ServerConfig
5858
TCHAR tszSQLPass[128];
5959
TCHAR tszDBName[128];
6060
int nSQLPort;
61-
int nSQLType;
62-
TCHAR tszSQLFile[MAX_PATH];
61+
BOOL bEnable;
6362
}st_XSql;
6463
struct
6564
{

XEngine_Source/StorageModule_Config/Config_Json/Config_Json.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,19 @@ BOOL CConfig_Json::Config_Json_File(LPCTSTR lpszConfigFile, XENGINE_SERVERCONFIG
128128
pSt_ServerConfig->st_XLog.nMaxCount = st_JsonXLog["MaxCount"].asInt();
129129
pSt_ServerConfig->st_XLog.nLogLeave = st_JsonXLog["LogLeave"].asInt();
130130

131-
if (st_JsonRoot["XSql"].empty() || (6 != st_JsonRoot["XSql"].size()))
131+
if (st_JsonRoot["XSql"].empty() || (5 != st_JsonRoot["XSql"].size()))
132132
{
133133
Config_IsErrorOccur = TRUE;
134134
Config_dwErrorCode = ERROR_XENGINE_BLOGIC_CONFIG_JSON_XSQL;
135135
return FALSE;
136136
}
137137
Json::Value st_JsonXSql = st_JsonRoot["XSql"];
138138

139-
pSt_ServerConfig->st_XSql.nSQLType = st_JsonXSql["SQLType"].asInt();
139+
pSt_ServerConfig->st_XSql.bEnable = st_JsonXSql["SQLEnable"].asBool();
140140
pSt_ServerConfig->st_XSql.nSQLPort = st_JsonXSql["SQLPort"].asInt();
141141
_tcscpy(pSt_ServerConfig->st_XSql.tszSQLAddr, st_JsonXSql["SQLAddr"].asCString());
142142
_tcscpy(pSt_ServerConfig->st_XSql.tszSQLUser, st_JsonXSql["SQLUser"].asCString());
143143
_tcscpy(pSt_ServerConfig->st_XSql.tszSQLPass, st_JsonXSql["SQLPass"].asCString());
144-
_tcscpy(pSt_ServerConfig->st_XSql.tszSQLFile, st_JsonXSql["SQLFile"].asCString());
145144

146145
if (st_JsonRoot["XStorage"].empty() || (3 != st_JsonRoot["XStorage"].size()))
147146
{
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#pragma once
2+
/********************************************************************
3+
// Created: 2022/03/29 14:21:46
4+
// File Name: D:\XEngine_Storage\XEngine_Source\StorageModule_Database\Database_Define.h
5+
// File Path: D:\XEngine_Storage\XEngine_Source\StorageModule_Database
6+
// File Base: Database_Define
7+
// File Ext: h
8+
// Project: XEngine(网络通信引擎)
9+
// Author: qyt
10+
// Purpose: 数据库操作导出函数
11+
// History:
12+
*********************************************************************/
13+
//////////////////////////////////////////////////////////////////////////
14+
/// 导出数据结构
15+
//////////////////////////////////////////////////////////////////////////
16+
typedef struct
17+
{
18+
XENGINE_PROTOCOL_FILE st_ProtocolFile;
19+
CHAR tszBuckKey[MAX_PATH]; //路径的关键字
20+
CHAR tszTableName[64]; //日期表名称,插入:表示自定义插入日期表,获取:表示导出这个文件所属日期表
21+
}XSTORAGECORE_DBFILE, *LPXSTORAGECORE_DBFILE;
22+
typedef struct
23+
{
24+
XENGINE_PROTOCOL_USERINFO st_ProtocolUser;
25+
__int64x nFileCount; //拥有的文件个数
26+
__int64x nFileSize; //文件占用大小
27+
XNETHANDLE xhToken; //用户临时会话句柄
28+
CHAR tszIPAddr[64]; //最后登录IP地址
29+
}XSTORAGECORE_USERINFO, *LPXSTORAGECORE_USERINFO;
30+
//////////////////////////////////////////////////////////////////////////
31+
/// 导出的函数
32+
//////////////////////////////////////////////////////////////////////////
33+
extern "C" DWORD Database_GetLastError(int *pInt_SysError = NULL);
34+
/************************************************************************/
35+
/* 导出的数据库操作函数 */
36+
/************************************************************************/
37+
extern "C" BOOL Database_File_Init(DATABASE_MYSQL_CONNECTINFO * pSt_DBConnector, int nTimeMonth = 1);
38+
extern "C" BOOL Database_File_Destory();
39+
/********************************************************************
40+
函数名称:Database_File_FileInsert
41+
函数功能:插入一个文件数据到数据库中
42+
参数.一:pSt_DBManage
43+
In/Out:In
44+
类型:数据结构指针
45+
可空:N
46+
意思:要插入的数据信息
47+
返回值
48+
类型:逻辑型
49+
意思:是否成功
50+
备注:这个结构所有值都必须填充
51+
*********************************************************************/
52+
extern "C" BOOL Database_File_FileInsert(XSTORAGECORE_DBFILE *pSt_DBManage);
53+
/********************************************************************
54+
函数名称:Database_File_FileDelete
55+
函数功能:删除一个数据库文件信息
56+
参数.一:lpszBuckKey
57+
In/Out:In
58+
类型:常量字符指针
59+
可空:Y
60+
意思:所属BUCK名称
61+
参数.二:lpszFile
62+
In/Out:In
63+
类型:常量字符指针
64+
可空:Y
65+
意思:要删除的文件全路径
66+
参数.三:lpszHash
67+
In/Out:In
68+
类型:常量字符指针
69+
可空:Y
70+
意思:要删除的文件HASH
71+
返回值
72+
类型:逻辑型
73+
意思:是否成功
74+
备注:参数不能全为空,不会删除文件
75+
*********************************************************************/
76+
extern "C" BOOL Database_File_FileDelete(LPCTSTR lpszBuckKey = NULL, LPCSTR lpszFile = NULL, LPCSTR lpszHash = NULL);
77+
/********************************************************************
78+
函数名称:Database_File_FileQuery
79+
函数功能:查询文件信息
80+
参数.一:pppSt_ListFile
81+
In/Out:Out
82+
类型:三级指针
83+
可空:N
84+
意思:导出查询到的文件列表,此函数需要调用基础库的内存释放函数
85+
参数.二:pInt_ListCount
86+
In/Out:Out
87+
类型:三级指针
88+
可空:N
89+
意思:导出文件个数
90+
参数.三:lpszTimeStart
91+
In/Out:In
92+
类型:常量字符指针
93+
可空:Y
94+
意思:查找开始时间,20190701
95+
参数.四:lpszTimeEnd
96+
In/Out:In
97+
类型:常量字符指针
98+
可空:Y
99+
意思:查找结束时间,20190730
100+
参数.五:lpszBuckKey
101+
In/Out:In
102+
类型:常量字符指针
103+
可空:Y
104+
意思:查询的BUCK名
105+
参数.六:lpszFile
106+
In/Out:In
107+
类型:常量字符指针
108+
可空:Y
109+
意思:要查询的名称
110+
参数.七:lpszHash
111+
In/Out:In
112+
类型:常量字符指针
113+
可空:Y
114+
意思:要查询的文件HASH
115+
参数.八:lpszTableName
116+
In/Out:In
117+
类型:常量字符指针
118+
可空:Y
119+
意思:输入要查询的表明,为NULL所有
120+
返回值
121+
类型:逻辑型
122+
意思:是否成功
123+
备注:返回假可能没有查找到,这条记录不存在.参数lpszFile和lpszMD5不能全为空
124+
*********************************************************************/
125+
extern "C" BOOL Database_File_FileQuery(XSTORAGECORE_DBFILE * **pppSt_ListFile, int* pInt_ListCount, LPCSTR lpszTimeStart = NULL, LPCSTR lpszTimeEnd = NULL, LPCTSTR lpszBuckKey = NULL, LPCSTR lpszFile = NULL, LPCSTR lpszHash = NULL, LPCTSTR lpszTableName = NULL);

XEngine_Source/XEngine_StorageComponents/XStorage_SQLPacket/SQLPacket_Error.h renamed to XEngine_Source/StorageModule_Database/Database_Error.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#pragma once
22
/********************************************************************
3-
// Created: 2019/6/28 14:56
4-
// Filename: E:\NetEngine_Windows\NetEngine_SourceCode\NetEngine_Storage\NetEngine_XStorageCore\XStorageCore_Error.h
5-
// File Path: E:\NetEngine_Windows\NetEngine_SourceCode\NetEngine_Storage\NetEngine_XStorageCore
6-
// File Base: XStorageCore_Error
7-
// File Ext: h
8-
// Project: NetEngine(网络通信引擎)
9-
// Author: qyt
10-
// Purpose: X存储服务导出错误
11-
// History:
3+
// Created: 2022/03/29 14:21:56
4+
// File Name: D:\XEngine_Storage\XEngine_Source\StorageModule_Database\Database_Error.h
5+
// File Path: D:\XEngine_Storage\XEngine_Source\StorageModule_Database
6+
// File Base: Database_Error
7+
// File Ext: h
8+
// Project: XEngine(网络通信引擎)
9+
// Author: qyt
10+
// Purpose: 数据库操作导出错误
11+
// History:
1212
*********************************************************************/
1313
//////////////////////////////////////////////////////////////////////////
1414
// 导出的数据库错误

0 commit comments

Comments
 (0)