Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
137
CryptoSource/SQLExecute/Main.cpp
Normal file
137
CryptoSource/SQLExecute/Main.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
#include <Nave/Nave.h>
|
||||
#include <Nave/NFIni.h>
|
||||
#include <Nave/NFFilePtr.h>
|
||||
#include <Nave/NFTokenizer.h>
|
||||
#include <NaveServer/NFDBComponent.h>
|
||||
|
||||
int wmain(int argc, WCHAR* argv[])
|
||||
{
|
||||
Nave::NFIni ini;
|
||||
ini.Open(L"./SQLExecute.ini");
|
||||
|
||||
// <20><><EFBFBD>α<CEB1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
WCHAR strFullPath[512];
|
||||
Nave::GetProgramDir(strFullPath, 512);
|
||||
// wprintf(strFullPath);
|
||||
|
||||
// DB<44><42><EFBFBD><EFBFBD> <20>õ<EFBFBD>.
|
||||
WCHAR strIP[32];
|
||||
WCHAR strName[32];
|
||||
WCHAR strUser[32];
|
||||
WCHAR strPass[32];
|
||||
{
|
||||
DWORD dwLen=32;
|
||||
ini.GetValue(L"DB", L"IP", strIP, dwLen);
|
||||
dwLen=32;
|
||||
ini.GetValue(L"DB", L"NAME", strName, dwLen);
|
||||
dwLen=32;
|
||||
ini.GetValue(L"DB", L"USER", strUser, dwLen);
|
||||
dwLen=32;
|
||||
ini.GetValue(L"DB", L"PASSWORD", strPass, dwLen);
|
||||
}
|
||||
|
||||
NaveServer::NFDBComponent m_DBComp;
|
||||
|
||||
if(!m_DBComp.Connect(strIP, strName, strUser, strPass))
|
||||
{
|
||||
wprintf(L"Database Connection Faild!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>õ<EFBFBD>
|
||||
WCHAR strTYPE[128];
|
||||
WCHAR strEvent[128];
|
||||
DWORD dwParameter = 0;
|
||||
WCHAR strList[128];
|
||||
WCHAR strLog[128];
|
||||
{
|
||||
DWORD dwLen=128;
|
||||
ini.GetValue(L"EXECUTE", L"TYPE", strTYPE, dwLen);
|
||||
dwLen=128;
|
||||
ini.GetValue(strTYPE, L"EVENT", strEvent, dwLen);
|
||||
ini.GetValue(strTYPE, L"PARAMETER", &dwParameter);
|
||||
dwLen=128;
|
||||
ini.GetValue(strTYPE, L"LIST", strList, dwLen);
|
||||
dwLen=128;
|
||||
ini.GetValue(strTYPE, L"RESULTLOG", strLog, dwLen);
|
||||
}
|
||||
|
||||
if(dwParameter < 0 || dwParameter > 10)
|
||||
{
|
||||
wprintf(L"Parameter : 0 > and < 10\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Nave::NFFilePtrW fp_list(strList, L"rt");
|
||||
Nave::NFFilePtrW fp_log(strLog, L"wt");
|
||||
|
||||
int iLine = 0;
|
||||
WCHAR szLine[1024];
|
||||
|
||||
WCHAR szQuery[1024];
|
||||
int iSize = 0;
|
||||
Nave::String arg[10];
|
||||
|
||||
while(!fp_list.IsEOF())
|
||||
{
|
||||
iLine++;
|
||||
|
||||
szLine[0] = 0;
|
||||
fgetws(szLine, 1024, fp_list);
|
||||
iSize = wcslen(szLine);
|
||||
if(iSize == 0)
|
||||
break;
|
||||
|
||||
if(szLine[iSize-1] == L'\n')
|
||||
szLine[iSize-1] = 0;
|
||||
|
||||
Nave::NFTokenizer strtok = Nave::NFTokenizer(szLine, L",");
|
||||
if(dwParameter > (DWORD)strtok.CountTokens())
|
||||
{
|
||||
fprintf(fp_log, "%d Line : Parameter Is NOT %d Count\n", iLine, dwParameter);
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int i = 0; i < (int)dwParameter; ++i)
|
||||
arg[i] = strtok.NextToken();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if(dwParameter == 0)
|
||||
swprintf(szQuery, strEvent);
|
||||
else if(dwParameter == 1)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str());
|
||||
else if(dwParameter == 2)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str());
|
||||
else if(dwParameter == 3)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str());
|
||||
else if(dwParameter == 4)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str(), arg[3].c_str());
|
||||
else if(dwParameter == 5)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str(), arg[3].c_str(), arg[4].c_str());
|
||||
else if(dwParameter == 6)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str(), arg[3].c_str(), arg[4].c_str(), arg[5].c_str());
|
||||
else if(dwParameter == 7)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str(), arg[3].c_str(), arg[4].c_str(), arg[5].c_str(), arg[6].c_str());
|
||||
else if(dwParameter == 8)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str(), arg[3].c_str(), arg[4].c_str(), arg[5].c_str(), arg[6].c_str(), arg[7].c_str());
|
||||
else if(dwParameter == 9)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str(), arg[3].c_str(), arg[4].c_str(), arg[5].c_str(), arg[6].c_str(), arg[7].c_str(), arg[8].c_str());
|
||||
else if(dwParameter == 10)
|
||||
swprintf(szQuery, strEvent, arg[0].c_str(), arg[1].c_str(), arg[2].c_str(), arg[3].c_str(), arg[4].c_str(), arg[5].c_str(), arg[6].c_str(), arg[7].c_str(), arg[8].c_str(), arg[9].c_str());
|
||||
|
||||
int Exc = 0;
|
||||
int Result = 0;
|
||||
if (m_DBComp.ExecuteQueryGetData(szQuery, (void *)&Result))
|
||||
{
|
||||
Exc = 1;
|
||||
}
|
||||
|
||||
fprintf(fp_log, "%d Line : Exec : %d, Return : %d\n", iLine, Exc, Result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_DBComp.DisconnectDataSource();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user