X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9ad8644e6bfafa45a5fbca4c357da13454746a49..02c7f0f453d4237a6cf6bec885863a32addb6d75:/projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp b/projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp index 82a999f7..70b9c64c 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp @@ -34,12 +34,12 @@ #include #include "postgresql_store.h" -#include "stg/stg_locker.h" +#include "stg/locker.h" //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::GetServicesList(vector * servicesList) const +int POSTGRESQL_STORE::GetServicesList(std::vector * servicesList) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -95,7 +95,7 @@ return 0; //----------------------------------------------------------------------------- int POSTGRESQL_STORE::SaveService(const SERVICE_CONF & sc) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -139,7 +139,7 @@ if (EscapeString(ecomment)) return -1; } -std::stringstream query; +std::ostringstream query; query << "UPDATE tb_services SET " << "comment = '" << ecomment << "', " << "cost = " << sc.cost << ", " @@ -173,9 +173,9 @@ return 0; //----------------------------------------------------------------------------- int POSTGRESQL_STORE::RestoreService(SERVICE_CONF * sc, - const string & name) const + const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -208,7 +208,7 @@ if (EscapeString(ename)) return -1; } -std::stringstream query; +std::ostringstream query; query << "SELECT comment, cost, pay_day FROM tb_services WHERE name = '" << ename << "'"; result = PQexec(connection, query.str().c_str()); @@ -260,9 +260,9 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::AddService(const string & name) const +int POSTGRESQL_STORE::AddService(const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -295,7 +295,7 @@ if (EscapeString(ename)) return -1; } -std::stringstream query; +std::ostringstream query; query << "INSERT INTO tb_services \ (name, comment, cost, pay_day) \ VALUES \ @@ -327,9 +327,9 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::DelService(const string & name) const +int POSTGRESQL_STORE::DelService(const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -362,7 +362,7 @@ if (EscapeString(ename)) return -1; } -std::stringstream query; +std::ostringstream query; query << "DELETE FROM tb_services WHERE name = '" << ename << "'"; result = PQexec(connection, query.str().c_str());