|
@@ -99,42 +99,7 @@ INT CDataImpl::QueryModInfo(IN OUT std::vector<STModInfo> &vtModInfo)
|
|
|
|
|
|
BOOL CDataImpl::InsertModInfo(IN STModInfo &stModInfo)
|
|
BOOL CDataImpl::InsertModInfo(IN STModInfo &stModInfo)
|
|
{
|
|
{
|
|
- if(m_psqlite3 == NULL)
|
|
|
|
- return FALSE;
|
|
|
|
-
|
|
|
|
- string strInsert = "INSERT INTO mod(mod_name,mod_addr,mod_ver) VALUES ('";
|
|
|
|
-#ifndef USE_UTF8
|
|
|
|
- strInsert.append(stModInfo.strName);
|
|
|
|
- strInsert.append("','");
|
|
|
|
- strInsert.append(stModInfo.strAddress);
|
|
|
|
- strInsert.append("','");
|
|
|
|
- strInsert.append(stModInfo.strVersion);
|
|
|
|
- strInsert.append("');");
|
|
|
|
-#else
|
|
|
|
- string str;
|
|
|
|
- CharEncoding::ASCII2UTF8(stModInfo.strName.c_str(),str);
|
|
|
|
- strInsert.append(str);
|
|
|
|
-
|
|
|
|
- strInsert.append("','");
|
|
|
|
- CharEncoding::ASCII2UTF8(stModInfo.strAddress.c_str(),str);
|
|
|
|
- strInsert.append(str);
|
|
|
|
-
|
|
|
|
- strInsert.append("','");
|
|
|
|
- CharEncoding::ASCII2UTF8(stModInfo.strVersion.c_str(),str);
|
|
|
|
- strInsert.append(str);
|
|
|
|
-
|
|
|
|
- strInsert.append("');");
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- char* psqlite_error = NULL;
|
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
|
- {
|
|
|
|
- Global::WriteTextLog(_T("InsertModInfo:%s"), psqlite_error);
|
|
|
|
- return FALSE;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return TRUE;
|
|
|
|
|
|
+ return InsertModInfo(stModInfo.strName.c_str(), stModInfo.strAddress.c_str(), stModInfo.strVersion.c_str());
|
|
}
|
|
}
|
|
|
|
|
|
BOOL CDataImpl::InsertModInfo(IN LPCSTR lpModName, IN LPCSTR lpModAddress, IN LPCSTR lpModVerion)
|
|
BOOL CDataImpl::InsertModInfo(IN LPCSTR lpModName, IN LPCSTR lpModAddress, IN LPCSTR lpModVerion)
|
|
@@ -187,40 +152,7 @@ BOOL CDataImpl::InsertModInfo(IN LPCSTR lpModName, IN LPCSTR lpModAddress, IN LP
|
|
|
|
|
|
BOOL CDataImpl::UpdateModInfo(IN STModInfo &stModInfo)
|
|
BOOL CDataImpl::UpdateModInfo(IN STModInfo &stModInfo)
|
|
{
|
|
{
|
|
- if(m_psqlite3 == NULL)
|
|
|
|
- return FALSE;
|
|
|
|
-
|
|
|
|
- string strUpdate = "UPDATE mod SET mod_addr = '";
|
|
|
|
-#ifndef USE_UTF8
|
|
|
|
- strUpdate.append(stModInfo.strAddress);
|
|
|
|
- strUpdate.append("', mod_ver = '");
|
|
|
|
- strUpdate.append(stModInfo.strVersion);
|
|
|
|
- strUpdate.append("' WHERE mod_name = '");
|
|
|
|
- strUpdate.append(stModInfo.strName);
|
|
|
|
- strUpdate.append("';");
|
|
|
|
-#else
|
|
|
|
- string str;
|
|
|
|
- CharEncoding::ASCII2UTF8(stModInfo.strAddress.c_str(),str);
|
|
|
|
- strUpdate.append(str);
|
|
|
|
-
|
|
|
|
- strUpdate.append("', mod_ver = '");
|
|
|
|
- CharEncoding::ASCII2UTF8(stModInfo.strVersion.c_str(),str);
|
|
|
|
- strUpdate.append(str);
|
|
|
|
-
|
|
|
|
- strUpdate.append("' WHERE mod_name = '");
|
|
|
|
- strUpdate.append(stModInfo.strName);
|
|
|
|
- strUpdate.append("';");
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- char* psqlite_error = NULL;
|
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strUpdate.c_str(), NULL, 0, &psqlite_error);
|
|
|
|
- if(SQLITE_OK != sqlite_error)
|
|
|
|
- {
|
|
|
|
- Global::WriteTextLog(_T("UpdateModInfo:%s"), psqlite_error);
|
|
|
|
- return FALSE;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return TRUE;
|
|
|
|
|
|
+ return UpdateModInfo(stModInfo.strName.c_str(), stModInfo.strAddress.c_str(), stModInfo.strVersion.c_str());
|
|
}
|
|
}
|
|
|
|
|
|
BOOL CDataImpl::UpdateModInfo(IN LPCSTR lpModName, IN LPCSTR lpModAddress, IN LPCSTR lpModVerion)
|
|
BOOL CDataImpl::UpdateModInfo(IN LPCSTR lpModName, IN LPCSTR lpModAddress, IN LPCSTR lpModVerion)
|
|
@@ -271,22 +203,7 @@ BOOL CDataImpl::UpdateModInfo(IN LPCSTR lpModName, IN LPCSTR lpModAddress, IN LP
|
|
|
|
|
|
BOOL CDataImpl::DeleteModInfo(IN STModInfo &stModInfo)
|
|
BOOL CDataImpl::DeleteModInfo(IN STModInfo &stModInfo)
|
|
{
|
|
{
|
|
- if (m_psqlite3 == NULL)
|
|
|
|
- return FALSE;
|
|
|
|
-
|
|
|
|
- string strDelete = "DELETE FROM mod WHERE mod_name ='";
|
|
|
|
- strDelete.append(stModInfo.strName);
|
|
|
|
- strDelete.append("';");
|
|
|
|
-
|
|
|
|
- char* psqlite_error = NULL;
|
|
|
|
- int sqlite_error = sqlite3_exec(m_psqlite3, strDelete.c_str(), NULL, 0, &psqlite_error);
|
|
|
|
- if (SQLITE_OK != sqlite_error)
|
|
|
|
- {
|
|
|
|
- Global::WriteTextLog(_T("DeleteModInfo:%s"), psqlite_error);
|
|
|
|
- return FALSE;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return TRUE;
|
|
|
|
|
|
+ return DeleteModInfo(stModInfo.strName.c_str());
|
|
}
|
|
}
|
|
|
|
|
|
BOOL CDataImpl::DeleteModInfo(IN LPCSTR lpModName)
|
|
BOOL CDataImpl::DeleteModInfo(IN LPCSTR lpModName)
|