diff --git a/src/db/Db2CppDb.cpp b/src/db/Db2CppDb.cpp index b48bba9..87e337e 100644 --- a/src/db/Db2CppDb.cpp +++ b/src/db/Db2CppDb.cpp @@ -86,10 +86,6 @@ Db2CppDb::Db2CppDb(const std::string &dbargs) debug = false; } -Db2CppDb::Db2CppDb(const Db2CppDb& orig) -{ - throw std::runtime_error("May not make copy of Db2CppDb"); -} Db2CppDb::~Db2CppDb() { @@ -290,7 +286,7 @@ void Db2CppDb::addGenericTeamEvent(int second, int team, int amount, const std:: DebugMessage("addGenericTeamEvent"); } -void Db2CppDb::addChallenge(int second, const std::string &player, int challenge, int amount) +void Db2CppDb::addChallenge(int, const std::string &player, int challenge, int amount) { if (!isok) { return; @@ -299,7 +295,7 @@ void Db2CppDb::addChallenge(int second, const std::string &player, int challenge DebugMessage("addChallenge"); } -void Db2CppDb::addAccuracy(int second, const std::string &player, int type, int shotsFired, int shotsHit) +void Db2CppDb::addAccuracy(int, const std::string &player, int type, int shotsFired, int shotsHit) { if (!isok) { return; @@ -319,20 +315,18 @@ void Db2CppDb::addAccuracy(int second, const std::string &player, int type, int int Db2CppDb::getNextGameNumber() { - int ret = -1; cppdb::result res = *sql<< "SELECT nextval('oastat_games_gamenumber_seq')"; DebugMessage("Gettings next game number"); if (res.next()) { + int ret = -1; res >> ret; return ret; - } else { - throw std::runtime_error("Could not get next gamenumber"); - } + } + throw std::runtime_error("Could not get next gamenumber"); } int Db2CppDb::getLastGameNumber() { - int result = -1; cppdb::result res; if (sql_backend == "mysql") { res = *sql << "SELECT LAST_INSERT_ID() FROM DUAL"; @@ -341,12 +335,12 @@ int Db2CppDb::getLastGameNumber() } DebugMessage("Gettings last game number"); if (res.next()) { + int result = -1; res>> result; std::cout << "Game number: " << result << "\n"; return result; - } else { - throw std::runtime_error("Could not get last gamenumber"); - } + } + throw std::runtime_error("Could not get last gamenumber"); } diff --git a/src/db/Db2CppDb.hpp b/src/db/Db2CppDb.hpp index e6cb167..01038af 100644 --- a/src/db/Db2CppDb.hpp +++ b/src/db/Db2CppDb.hpp @@ -32,8 +32,9 @@ https://github.com/sago007/oastat/ class Db2CppDb : public Database { public: Db2CppDb(); - Db2CppDb(const std::string &dbargs); - Db2CppDb(const Db2CppDb& orig); + explicit Db2CppDb(const std::string &dbargs); + Db2CppDb(const Db2CppDb& orig) = delete; + Db2CppDb& operator=(const Db2CppDb&) = delete; virtual ~Db2CppDb(); void createTables() override; void startGame(int gametype, const std::string &mapname, const std::string &basegame, const std::string &servername, const OaStatStruct &oss) override; diff --git a/src/db/Db2Xml.cpp b/src/db/Db2Xml.cpp index 124c301..74b0225 100644 --- a/src/db/Db2Xml.cpp +++ b/src/db/Db2Xml.cpp @@ -22,6 +22,7 @@ https://github.com/sago007/oastat/ */ #include "Db2Xml.hpp" +#include using std::cout; using std::ofstream; @@ -76,10 +77,7 @@ Db2Xml::Db2Xml(std::string dbargs) cout << "Attemting to create \"" << path << "\" with \"" << fmkdir.str() << "\", but return code was: " << fmkdir_ret << "\n"; } } -Db2Xml::Db2Xml(const Db2Xml& orig) -{ -} Db2Xml::~Db2Xml() { diff --git a/src/db/Db2Xml.hpp b/src/db/Db2Xml.hpp index 93fe933..b671120 100644 --- a/src/db/Db2Xml.hpp +++ b/src/db/Db2Xml.hpp @@ -33,15 +33,15 @@ https://github.com/sago007/oastat/ #include #include #include -#include #include class Db2Xml : public Database { public: Db2Xml(); - Db2Xml(std::string dbargs); - Db2Xml(const Db2Xml& orig); + explicit Db2Xml(std::string dbargs); + Db2Xml(const Db2Xml& orig) = delete; + Db2Xml& operator=(const Db2Xml&) = delete; virtual ~Db2Xml(); void createTables() override; void startGame(int gametype, const std::string &mapname, const std::string &basegame, const std::string &servername, const OaStatStruct &oss) override; diff --git a/src/oastat.cpp b/src/oastat.cpp index 632f5d1..bd962d3 100644 --- a/src/oastat.cpp +++ b/src/oastat.cpp @@ -32,7 +32,7 @@ https://github.com/sago007/oastat/ #include #include #include -#include +#include #include #include "db/database.hpp"