Skip to content

Commit 2c8b655

Browse files
committed
modify:Supports bucket condition query
modify:file path parament does not need and file name and hash value is not null default parament
1 parent b5beb39 commit 2c8b655

File tree

4 files changed

+37
-30
lines changed

4 files changed

+37
-30
lines changed

XEngine_Source/StorageModule_Database/Database_Define.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,24 +361,24 @@ extern "C" bool Database_Memory_FileDelete(LPCXSTR lpszFilePath = NULL, LPCXSTR
361361
类型:三级指针
362362
可空:N
363363
意思:导出文件个数
364-
参数.三:lpszFilePath
364+
参数.三:lpszBucketName
365365
In/Out:In
366366
类型:常量字符指针
367-
可空:Y
368-
意思:要查询的路径
367+
可空:N
368+
意思:要查询的BUCKET名称
369369
参数.四:lpszFileName
370370
In/Out:In
371371
类型:常量字符指针
372-
可空:Y
372+
可空:N
373373
意思:要查询的名称
374374
参数.五:lpszHash
375375
In/Out:In
376376
类型:常量字符指针
377-
可空:Y
377+
可空:N
378378
意思:要查询的文件HASH
379379
返回值
380380
类型:逻辑型
381381
意思:是否成功
382-
备注:返回假可能没有查找到,这条记录不存在.参数lpszFile和lpszHash不能全为空
382+
备注:
383383
*********************************************************************/
384-
extern "C" bool Database_Memory_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszFilePath = NULL, LPCXSTR lpszFileName = NULL, LPCXSTR lpszHash = NULL);
384+
extern "C" bool Database_Memory_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszBucketName, LPCXSTR lpszFileName, LPCXSTR lpszHash);

XEngine_Source/StorageModule_Database/Database_Memory/Database_Memory.cpp

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -182,54 +182,61 @@ bool CDatabase_Memory::Database_Memory_FileDelete(LPCXSTR lpszFilePath /* = NULL
182182
类型:三级指针
183183
可空:N
184184
意思:导出文件个数
185-
参数.三:lpszFilePath
185+
参数.三:lpszBucketName
186186
In/Out:In
187187
类型:常量字符指针
188-
可空:Y
189-
意思:要查询的路径
188+
可空:N
189+
意思:要查询的BUCKET名称
190190
参数.四:lpszFileName
191191
In/Out:In
192192
类型:常量字符指针
193-
可空:Y
193+
可空:N
194194
意思:要查询的名称
195195
参数.五:lpszHash
196196
In/Out:In
197197
类型:常量字符指针
198-
可空:Y
198+
可空:N
199199
意思:要查询的文件HASH
200200
返回值
201201
类型:逻辑型
202202
意思:是否成功
203-
备注:返回假可能没有查找到,这条记录不存在.参数lpszFile和lpszHash不能全为空
203+
备注:
204204
*********************************************************************/
205-
bool CDatabase_Memory::Database_Memory_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszFilePath /* = NULL */, LPCXSTR lpszFileName /* = NULL */, LPCXSTR lpszHash /* = NULL */)
205+
bool CDatabase_Memory::Database_Memory_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszBucketName, LPCXSTR lpszFileName, LPCXSTR lpszHash)
206206
{
207207
Database_IsErrorOccur = false;
208208

209-
if ((NULL == lpszHash) && (NULL == lpszFileName))
210-
{
211-
Database_IsErrorOccur = true;
212-
Database_dwErrorCode = ERROR_XENGINE_XSTROGE_CORE_DB_QUERYFILE_PARAMENT;
213-
return false;
214-
}
215209
bool bFound = false;
216210
st_Locker->lock_shared();
217211
auto stl_ListIterator = stl_ListFile.begin();
218212
for (; stl_ListIterator != stl_ListFile.end(); stl_ListIterator++)
219213
{
220-
if (NULL != lpszHash)
214+
if (_tcsxlen(lpszHash) > 0)
221215
{
222216
if (0 == _tcsxnicmp(lpszHash, stl_ListIterator->st_ProtocolFile.tszFileHash, _tcsxlen(lpszHash)))
223217
{
224-
bFound = true;
225-
break;
218+
if (_tcsxlen(lpszBucketName) > 0)
219+
{
220+
if (0 == _tcsxnicmp(lpszBucketName, stl_ListIterator->tszBuckKey, _tcsxlen(lpszBucketName)))
221+
{
222+
bFound = true;
223+
break;
224+
}
225+
}
226226
}
227227
}
228-
else if (NULL != lpszFileName)
228+
else if (_tcsxlen(lpszFileName) > 0)
229229
{
230-
if (0 == _tcsxnicmp(lpszFilePath, stl_ListIterator->st_ProtocolFile.tszFilePath, _tcsxlen(lpszFilePath)) && 0 == _tcsxnicmp(lpszFileName, stl_ListIterator->st_ProtocolFile.tszFileName, _tcsxlen(lpszFileName)))
230+
if (0 == _tcsxnicmp(lpszFileName, stl_ListIterator->st_ProtocolFile.tszFileName, _tcsxlen(lpszFileName)))
231231
{
232-
bFound = true;
232+
if (_tcsxlen(lpszBucketName) > 0)
233+
{
234+
if (0 == _tcsxnicmp(lpszBucketName, stl_ListIterator->tszBuckKey, _tcsxlen(lpszBucketName)))
235+
{
236+
bFound = true;
237+
break;
238+
}
239+
}
233240
break;
234241
}
235242
}
@@ -309,7 +316,7 @@ XHTHREAD CDatabase_Memory::Database_Memory_Thread(XPVOID lParam)
309316
CDatabase_Memory *pClass_This = (CDatabase_Memory *)lParam;
310317
time_t nTimeStart = time(NULL);
311318
time_t nTimeEnd = 0;
312-
int nTime = 60 * 60 * 12;
319+
int nTime = 60;
313320

314321
while (pClass_This->m_bIsRun)
315322
{

XEngine_Source/StorageModule_Database/Database_Memory/Database_Memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CDatabase_Memory
2121
bool Database_Memory_Destory();
2222
bool Database_Memory_FileInsert(XSTORAGECORE_DBFILE *pSt_DBManage);
2323
bool Database_Memory_FileDelete(LPCXSTR lpszFilePath = NULL, LPCXSTR lpszFileName = NULL, LPCXSTR lpszHash = NULL);
24-
bool Database_Memory_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszFilePath = NULL, LPCXSTR lpszFileName = NULL, LPCXSTR lpszHash = NULL);
24+
bool Database_Memory_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszBucketName, LPCXSTR lpszFileName, LPCXSTR lpszHash);
2525
protected:
2626
bool Database_Memory_Flush();
2727
protected:

XEngine_Source/StorageModule_Database/pch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ extern "C" bool Database_Memory_FileDelete(LPCXSTR lpszFilePath, LPCXSTR lpszFil
8787
{
8888
return m_SQLMemory.Database_Memory_FileDelete(lpszFilePath, lpszFileName, lpszHash);
8989
}
90-
extern "C" bool Database_Memory_FileQuery(XSTORAGECORE_DBFILE * **pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszFilePath, LPCXSTR lpszFileName, LPCXSTR lpszHash)
90+
extern "C" bool Database_Memory_FileQuery(XSTORAGECORE_DBFILE * **pppSt_ListFile, int* pInt_ListCount, LPCXSTR lpszBucketName, LPCXSTR lpszFileName, LPCXSTR lpszHash)
9191
{
92-
return m_SQLMemory.Database_Memory_FileQuery(pppSt_ListFile, pInt_ListCount, lpszFilePath, lpszFileName, lpszHash);
92+
return m_SQLMemory.Database_Memory_FileQuery(pppSt_ListFile, pInt_ListCount, lpszBucketName, lpszFileName, lpszHash);
9393
}

0 commit comments

Comments
 (0)