#include <libpq-fe.h>
#include "postgresql_store.h"
-#include "stg_locker.h"
+#include "stg/locker.h"
//-----------------------------------------------------------------------------
-int POSTGRESQL_STORE::GetCorpsList(vector<string> * corpsList) const
+int POSTGRESQL_STORE::GetCorpsList(std::vector<std::string> * corpsList) const
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
return -1;
}
-std::stringstream query;
+std::ostringstream query;
query << "UPDATE tb_corporations SET "
<< "cash = " << cc.cash
<< "WHERE name = '" << ename << "'";
}
//-----------------------------------------------------------------------------
-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__);
return -1;
}
-std::stringstream query;
+std::ostringstream query;
query << "SELECT cash FROM tb_corporations WHERE name = '" << ename << "'";
result = PQexec(connection, query.str().c_str());
}
//-----------------------------------------------------------------------------
-int POSTGRESQL_STORE::AddCorp(const string & name) const
+int POSTGRESQL_STORE::AddCorp(const std::string & name) const
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
return -1;
}
-std::stringstream query;
+std::ostringstream query;
query << "INSERT INTO tb_corporations \
(name, cash) \
VALUES \
}
//-----------------------------------------------------------------------------
-int POSTGRESQL_STORE::DelCorp(const string & name) const
+int POSTGRESQL_STORE::DelCorp(const std::string & name) const
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
return -1;
}
-std::stringstream query;
+std::ostringstream query;
query << "DELETE FROM tb_corporations WHERE name = '" << ename << "'";
result = PQexec(connection, query.str().c_str());