From 1b719c2e3103dbb9b7ca09bcf66550c908550fe5 Mon Sep 17 00:00:00 2001 From: errorage Date: Thu, 27 Jun 2013 23:17:39 +0200 Subject: [PATCH] Database related fixes: - Fixes the following SQL error: [13:44:09]GAME: SQL ERROR during death reporting. Error : [Table 'ss13.death' doesn't exist] The issue was with cyborg death logging, which was not updated properly to log into the correct table. - Fixed the SQL schema so it properly logs deaths and the legacy_population thing (which logs how many admins and players were on every 5 minutes). If you already have a database set up and don't want to completely wipe it (Let's be honest, you really don't want to do that), look at this thread for help in updating the database properly: http://www.ss13.eu/phpbb/viewtopic.php?f=6&t=194 --- SQL/tgstation_schema.sql | 28 ++++++++++++++-------------- code/defines/procs/statistics.dm | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/SQL/tgstation_schema.sql b/SQL/tgstation_schema.sql index 54e5a628563..bab321c3e74 100644 --- a/SQL/tgstation_schema.sql +++ b/SQL/tgstation_schema.sql @@ -27,7 +27,7 @@ CREATE TABLE `erro_admin` ( `flags` int(16) NOT NULL DEFAULT '0', `email` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=77 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44,7 +44,7 @@ CREATE TABLE `erro_admin_log` ( `adminip` varchar(18) NOT NULL, `log` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=560 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79,7 +79,7 @@ CREATE TABLE `erro_ban` ( `unbanned_computerid` varchar(32) DEFAULT NULL, `unbanned_ip` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7755 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -97,7 +97,7 @@ CREATE TABLE `erro_connection_log` ( `ip` varchar(18) DEFAULT NULL, `computerid` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=311192 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -108,7 +108,7 @@ DROP TABLE IF EXISTS `erro_death`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `erro_death` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL AUTO_INCREMENT, `pod` text NOT NULL COMMENT 'Place of death', `coord` text NOT NULL COMMENT 'X, Y, Z POD', `tod` datetime NOT NULL COMMENT 'Time of death', @@ -141,7 +141,7 @@ CREATE TABLE `erro_feedback` ( `var_value` int(16) DEFAULT NULL, `details` text, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=456134 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -152,7 +152,7 @@ DROP TABLE IF EXISTS `erro_legacy_population`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `erro_legacy_population` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL AUTO_INCREMENT, `playercount` int(11) DEFAULT NULL, `admincount` int(11) DEFAULT NULL, `time` datetime NOT NULL @@ -173,7 +173,7 @@ CREATE TABLE `erro_library` ( `ckey` varchar(45) DEFAULT 'LEGACY', `datetime` datetime DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5370 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Table structure for table `erro_player` @@ -192,7 +192,7 @@ CREATE TABLE `erro_player` ( `lastadminrank` varchar(32) NOT NULL DEFAULT 'Player', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) -) ENGINE=InnoDB AUTO_INCREMENT=8849 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -213,7 +213,7 @@ CREATE TABLE `erro_poll_option` ( `descmid` varchar(32) DEFAULT NULL, `descmax` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=330 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -232,7 +232,7 @@ CREATE TABLE `erro_poll_question` ( `adminonly` tinyint(1) DEFAULT '0', `multiplechoiceoptions` int(2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -251,7 +251,7 @@ CREATE TABLE `erro_poll_textreply` ( `replytext` text NOT NULL, `adminrank` varchar(32) NOT NULL DEFAULT 'Player', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=144 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -271,7 +271,7 @@ CREATE TABLE `erro_poll_vote` ( `adminrank` varchar(32) NOT NULL, `rating` int(2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=15753 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -287,7 +287,7 @@ CREATE TABLE `erro_privacy` ( `ckey` varchar(32) NOT NULL, `option` varchar(128) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5011 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; diff --git a/code/defines/procs/statistics.dm b/code/defines/procs/statistics.dm index 9e5ad12f28e..e0a97085222 100644 --- a/code/defines/procs/statistics.dm +++ b/code/defines/procs/statistics.dm @@ -104,7 +104,7 @@ proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H) if(!dbcon.IsConnected()) log_game("SQL ERROR during death reporting. Failed to connect.") else - var/DBQuery/query = dbcon.NewQuery("INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')") + var/DBQuery/query = dbcon.NewQuery("INSERT INTO erro_death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')") if(!query.Execute()) var/err = query.ErrorMsg() log_game("SQL ERROR during death reporting. Error : \[[err]\]\n") @@ -160,4 +160,4 @@ proc/sql_commit_feedback() var/DBQuery/query = dbcon.NewQuery("INSERT INTO erro_feedback (id, roundid, time, variable, value) VALUES (null, [newroundid], Now(), '[variable]', '[value]')") if(!query.Execute()) var/err = query.ErrorMsg() - log_game("SQL ERROR during death reporting. Error : \[[err]\]\n") \ No newline at end of file + log_game("SQL ERROR during feedback reporting. Error : \[[err]\]\n") \ No newline at end of file