git repos / oastat

commit 37db2b08

sago007 · 2019-03-23 14:39
37db2b083c6edd672b855a0a1d7cc2050b59416a patch · browse files
parent c9ef9add5deac9bf5a8a84cd1d2fb28312f43102

Add missing fileso

Changed files

A src/db/DbExtra.cpp
A src/db/DbExtra.hpp
diff --git a/src/db/DbExtra.cpp b/src/db/DbExtra.cpp new file mode 100644 index 0000000..81b5d30 --- /dev/null +++ b/src/db/DbExtra.cpp
@@ -0,0 +1,50 @@
+/*
+===========================================================================
+oastat - a program for parsing log files and write the result to a database
+Copyright (C) 2014 Poul Sander
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see http://www.gnu.org/licenses/
+
+Source information and contacts persons can be found at
+https://github.com/sago007/oastat/
+===========================================================================
+*/
+
+#include "DbExtra.hpp"
+
+void deleteGame(cppdb::session* connection, int gamenumber) {
+ const char* deleteAccuracy = "delete from oastat_accuracy where gamenumber = ?";
+ const char* deleteAwards = "delete from oastat_awards where gamenumber = ?";
+ const char* deleteChallenges = "delete from oastat_challenges where gamenumber = ?";
+ const char* deleteGameCvars = "delete from oastat_gamecvars where gamenumber = ?";
+ const char* deleteKills = "delete from oastat_kills where gamenumber = ?";
+ const char* deletePoints = "delete from oastat_points where gamenumber = ?";
+ const char* deleteTeamEvents = "delete from oastat_team_events where gamenumber = ?";
+
+ const char* deleteUserInfoVars = "delete from oastat_uservars where userinfoevent in (select eventNumber from oastat_userinfo where gamenumber = ?)";
+ const char* deleteUserInfo = "delete from oastat_userinfo where gamenumber = ?";
+
+ const char* deleteGame = "delete from oastat_games where gamenumber = ?";
+
+ *connection << deleteAccuracy << gamenumber << cppdb::exec;
+ *connection << deleteAwards << gamenumber << cppdb::exec;
+ *connection << deleteChallenges << gamenumber << cppdb::exec;
+ *connection << deleteGameCvars << gamenumber << cppdb::exec;
+ *connection << deleteKills << gamenumber << cppdb::exec;
+ *connection << deletePoints << gamenumber << cppdb::exec;
+ *connection << deleteTeamEvents << gamenumber << cppdb::exec;
+ *connection << deleteUserInfoVars << gamenumber << cppdb::exec;
+ *connection << deleteUserInfo << gamenumber << cppdb::exec;
+ *connection << deleteGame << gamenumber << cppdb::exec;
+}
diff --git a/src/db/DbExtra.hpp b/src/db/DbExtra.hpp new file mode 100644 index 0000000..aee0b17 --- /dev/null +++ b/src/db/DbExtra.hpp
@@ -0,0 +1,26 @@
+/*
+===========================================================================
+oastat - a program for parsing log files and write the result to a database
+Copyright (C) 2014 Poul Sander
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see http://www.gnu.org/licenses/
+
+Source information and contacts persons can be found at
+https://github.com/sago007/oastat/
+===========================================================================
+*/
+
+#include <cppdb/frontend.h>
+
+void deleteGame(cppdb::session* connection, int gamenumber);