X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/90e389f6ec12e60a62c362296ffcf314feb5b03d..c3d4d096451b5c683492e81574b302e5486950e1:/projects/stargazer/plugins/store/postgresql/postgresql_store_corporations.cpp diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store_corporations.cpp b/projects/stargazer/plugins/store/postgresql/postgresql_store_corporations.cpp index c358a4c5..84fab02b 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_corporations.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_corporations.cpp @@ -36,9 +36,9 @@ #include "stg/locker.h" //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::GetCorpsList(vector * corpsList) const +int POSTGRESQL_STORE::GetCorpsList(std::vector * corpsList) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -94,7 +94,7 @@ return 0; //----------------------------------------------------------------------------- int POSTGRESQL_STORE::SaveCorp(const CORP_CONF & cc) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -127,7 +127,7 @@ if (EscapeString(ename)) return -1; } -std::stringstream query; +std::ostringstream query; query << "UPDATE tb_corporations SET " << "cash = " << cc.cash << "WHERE name = '" << ename << "'"; @@ -158,9 +158,9 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::RestoreCorp(CORP_CONF * cc, const string & name) const +int POSTGRESQL_STORE::RestoreCorp(CORP_CONF * cc, const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -193,7 +193,7 @@ if (EscapeString(ename)) return -1; } -std::stringstream query; +std::ostringstream query; query << "SELECT cash FROM tb_corporations WHERE name = '" << ename << "'"; result = PQexec(connection, query.str().c_str()); @@ -241,9 +241,9 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::AddCorp(const string & name) const +int POSTGRESQL_STORE::AddCorp(const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -276,7 +276,7 @@ if (EscapeString(ename)) return -1; } -std::stringstream query; +std::ostringstream query; query << "INSERT INTO tb_corporations \ (name, cash) \ VALUES \ @@ -308,9 +308,9 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::DelCorp(const string & name) const +int POSTGRESQL_STORE::DelCorp(const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -343,7 +343,7 @@ if (EscapeString(ename)) return -1; } -std::stringstream query; +std::ostringstream query; query << "DELETE FROM tb_corporations WHERE name = '" << ename << "'"; result = PQexec(connection, query.str().c_str());