diff --git a/src/db/Db2CppDb.cpp b/src/db/Db2CppDb.cpp index 87e337e..f85589c 100644 --- a/src/db/Db2CppDb.cpp +++ b/src/db/Db2CppDb.cpp @@ -102,18 +102,20 @@ void Db2CppDb::startGame(int gametype, const std::string &mapname, const std::st sql = std::shared_ptr(new cppdb::session(connectstring)); commitlock = std::shared_ptr(new cppdb::transaction(*sql)); Rollback(); //in case there was some garbage that could be comitted (like warmup or an unfinished game) - SetOk(true); + SetOk(false); timestamp = oss.getDateTime(); if (oss.restOfLine.find("\\isWarmup\\1") != std::string::npos) { - SetOk(false); std::cout << "Warmup: " << servername << ", " << oss.getTimeStamp() << "\n"; return; } if (IsDuplicate(servername,timestamp)) { - SetOk(false); std::cout << "Duplicate:" << servername << ", " << oss.getTimeStamp() << "\n"; return; } + if (oss.getDateTime().tm_year+1900 == 0) { + std::cout << "No timestamp: "<< servername << "\n"; + return; + } if (last_value) { cppdb::statement st = *sql << "INSERT INTO oastat_games(gametype, mapname, basegame,servername,time) VALUES (?,LOWER(?),?,?,?)"; //< &db,std::vector > &commands) { - bool done = true; + bool done = false; OaStatStruct *startstruct = nullptr; - do { + while(!done) { + done = true; std::string line = ""; OaStatStruct oss; std::deque osslist; @@ -140,12 +141,13 @@ static int processStdIn(std::istream &in_p, std::vector