X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/c3d4d096451b5c683492e81574b302e5486950e1..c02633d77cb05a5deb05440d77b12ccc5bc19b85:/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 70b9c64c..3d098161 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_services.cpp @@ -27,15 +27,18 @@ * */ +#include "postgresql_store.h" + +#include "stg/service_conf.h" +#include "stg/common.h" +#include "stg/locker.h" + #include #include #include #include -#include "postgresql_store.h" -#include "stg/locker.h" - //----------------------------------------------------------------------------- int POSTGRESQL_STORE::GetServicesList(std::vector * servicesList) const { @@ -68,9 +71,9 @@ if (PQresultStatus(result) != PGRES_TUPLES_OK) PQclear(result); printfd(__FILE__, "POSTGRESQL_STORE::GetServicesList(): '%s'\n", strError.c_str()); if (RollbackTransaction()) - { - printfd(__FILE__, "POSTGRESQL_STORE::GetServicesList(): 'Failed to rollback transaction'\n"); - } + { + printfd(__FILE__, "POSTGRESQL_STORE::GetServicesList(): 'Failed to rollback transaction'\n"); + } return -1; } @@ -93,7 +96,7 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::SaveService(const SERVICE_CONF & sc) const +int POSTGRESQL_STORE::SaveService(const STG::ServiceConf & sc) const { STG_LOCKER lock(&mutex); @@ -123,9 +126,9 @@ if (EscapeString(ename)) { printfd(__FILE__, "POSTGRESQL_STORE::SaveService(): 'Failed to escape name'\n"); if (RollbackTransaction()) - { - printfd(__FILE__, "POSTGRESQL_STORE::SaveService(): 'Failed to rollback transaction'\n"); - } + { + printfd(__FILE__, "POSTGRESQL_STORE::SaveService(): 'Failed to rollback transaction'\n"); + } return -1; } @@ -133,9 +136,9 @@ if (EscapeString(ecomment)) { printfd(__FILE__, "POSTGRESQL_STORE::SaveService(): 'Failed to escape comment'\n"); if (RollbackTransaction()) - { - printfd(__FILE__, "POSTGRESQL_STORE::SaveService(): 'Failed to rollback transaction'\n"); - } + { + printfd(__FILE__, "POSTGRESQL_STORE::SaveService(): 'Failed to rollback transaction'\n"); + } return -1; } @@ -172,8 +175,8 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::RestoreService(SERVICE_CONF * sc, - const std::string & name) const +int POSTGRESQL_STORE::RestoreService(STG::ServiceConf * sc, + const std::string & name) const { STG_LOCKER lock(&mutex); @@ -202,9 +205,9 @@ if (EscapeString(ename)) { printfd(__FILE__, "POSTGRESQL_STORE::RestoreService(): 'Failed to escape name'\n"); if (RollbackTransaction()) - { - printfd(__FILE__, "POSTGRESQL_STORE::RestoreService(): 'Failed to rollback transaction'\n"); - } + { + printfd(__FILE__, "POSTGRESQL_STORE::RestoreService(): 'Failed to rollback transaction'\n"); + } return -1; } @@ -233,9 +236,9 @@ if (tuples != 1) printfd(__FILE__, "POSTGRESQL_STORE::RestoreService(): 'Invalid number of tuples. Wanted 1, actulally %d'\n", tuples); PQclear(result); if (RollbackTransaction()) - { - printfd(__FILE__, "POSTGRESQL_STORE::RestoreService(): 'Failed to rollback transaction'\n"); - } + { + printfd(__FILE__, "POSTGRESQL_STORE::RestoreService(): 'Failed to rollback transaction'\n"); + } return -1; } @@ -289,9 +292,9 @@ if (EscapeString(ename)) { printfd(__FILE__, "POSTGRESQL_STORE::AddService(): 'Failed to escape name'\n"); if (RollbackTransaction()) - { - printfd(__FILE__, "POSTGRESQL_STORE::AddService(): 'Failed to rollback transaction'\n"); - } + { + printfd(__FILE__, "POSTGRESQL_STORE::AddService(): 'Failed to rollback transaction'\n"); + } return -1; } @@ -356,9 +359,9 @@ if (EscapeString(ename)) { printfd(__FILE__, "POSTGRESQL_STORE::DelService(): 'Failed to escape name'\n"); if (RollbackTransaction()) - { - printfd(__FILE__, "POSTGRESQL_STORE::DelService(): 'Failed to rollback transaction'\n"); - } + { + printfd(__FILE__, "POSTGRESQL_STORE::DelService(): 'Failed to rollback transaction'\n"); + } return -1; }