summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-10-12 21:43:39 -0400
committerAdam <Adam@anope.org>2010-10-12 21:43:39 -0400
commitdc0c07b408e0d31f39355e1ab28cb7751d531d90 (patch)
tree86f6e0f7b32ca6eef0d38d0878dd11d691ab327a
parentafb55a1842e57bc6a4b61e70c047ea57597c5a69 (diff)
Made the SQL tables use foriegn keys and references to each other, removed many now unnecessary queries from db_mysql
-rw-r--r--data/mysql/tables.sql332
-rw-r--r--modules/extra/db_mysql.cpp77
2 files changed, 236 insertions, 173 deletions
diff --git a/data/mysql/tables.sql b/data/mysql/tables.sql
index 6b9c41b89..c9a781876 100644
--- a/data/mysql/tables.sql
+++ b/data/mysql/tables.sql
@@ -1,16 +1,30 @@
+-- phpMyAdmin SQL Dump
+-- version 3.3.5
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Generation Time: Oct 12, 2010 at 06:36 PM
+-- Server version: 5.1.50
+-- PHP Version: 5.2.14-pl0-gentoo
+
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
+-- Database: `anope`
+--
+
+-- --------------------------------------------------------
+
+--
-- Table structure for table `anope_bs_badwords`
--
-DROP TABLE IF EXISTS `anope_bs_badwords`;
CREATE TABLE IF NOT EXISTS `anope_bs_badwords` (
- `channel` varchar(255) NOT NULL default '',
+ `channel` varchar(255) NOT NULL DEFAULT '',
`word` varchar(255) NOT NULL,
`type` varchar(50) NOT NULL,
UNIQUE KEY `channel` (`channel`,`word`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -18,17 +32,16 @@ CREATE TABLE IF NOT EXISTS `anope_bs_badwords` (
-- Table structure for table `anope_bs_core`
--
-DROP TABLE IF EXISTS `anope_bs_core`;
CREATE TABLE IF NOT EXISTS `anope_bs_core` (
- `nick` varchar(255) NOT NULL default '',
- `user` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
+ `user` varchar(255) NOT NULL DEFAULT '',
`host` text NOT NULL,
`rname` text NOT NULL,
`flags` text NOT NULL,
- `created` int(10) unsigned NOT NULL default '0',
- `chancount` int(11) NOT NULL default '0',
- PRIMARY KEY (`nick`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `created` int(10) unsigned NOT NULL DEFAULT '0',
+ `chancount` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`nick`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -36,12 +49,12 @@ CREATE TABLE IF NOT EXISTS `anope_bs_core` (
-- Table structure for table `anope_bs_info_metadata`
--
-DROP TABLE IF EXISTS `anope_bs_info_metadata`;
CREATE TABLE IF NOT EXISTS `anope_bs_info_metadata` (
- `botname` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
- `value` text NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `botname` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
+ `value` text NOT NULL,
+ KEY `FK_anope_bs_info_metadata_botname` (`botname`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -49,15 +62,14 @@ CREATE TABLE IF NOT EXISTS `anope_bs_info_metadata` (
-- Table structure for table `anope_cs_access`
--
-DROP TABLE IF EXISTS `anope_cs_access`;
CREATE TABLE IF NOT EXISTS `anope_cs_access` (
- `level` int(11) NOT NULL default '0',
- `display` varchar(255) NOT NULL default '',
- `channel` varchar(255) NOT NULL default '',
- `last_seen` int(10) unsigned NOT NULL default '0',
- `creator` varchar(255) NOT NULL default '',
+ `level` int(11) NOT NULL DEFAULT '0',
+ `display` varchar(255) NOT NULL DEFAULT '',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `last_seen` int(10) unsigned NOT NULL DEFAULT '0',
+ `creator` varchar(255) NOT NULL DEFAULT '',
UNIQUE KEY `channel` (`channel`,`display`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -65,17 +77,16 @@ CREATE TABLE IF NOT EXISTS `anope_cs_access` (
-- Table structure for table `anope_cs_akick`
--
-DROP TABLE IF EXISTS `anope_cs_akick`;
CREATE TABLE IF NOT EXISTS `anope_cs_akick` (
- `channel` varchar(255) NOT NULL default '',
- `flags` varchar(255) NOT NULL default '',
- `mask` varchar(255) NOT NULL default '',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `flags` varchar(255) NOT NULL DEFAULT '',
+ `mask` varchar(255) NOT NULL DEFAULT '',
`reason` text NOT NULL,
- `creator` varchar(255) NOT NULL default '',
- `created` int(10) unsigned NOT NULL default '0',
- `last_used` int(10) unsigned NOT NULL default '0',
+ `creator` varchar(255) NOT NULL DEFAULT '',
+ `created` int(10) unsigned NOT NULL DEFAULT '0',
+ `last_used` int(10) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`mask`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -83,35 +94,34 @@ CREATE TABLE IF NOT EXISTS `anope_cs_akick` (
-- Table structure for table `anope_cs_info`
--
-DROP TABLE IF EXISTS `anope_cs_info`;
CREATE TABLE IF NOT EXISTS `anope_cs_info` (
- `name` varchar(255) NOT NULL default '',
+ `name` varchar(255) NOT NULL DEFAULT '',
`founder` text NOT NULL,
`successor` text NOT NULL,
`descr` text NOT NULL,
- `time_registered` int(10) unsigned NOT NULL default '0',
- `last_used` int(10) unsigned NOT NULL default '0',
+ `time_registered` int(10) unsigned NOT NULL DEFAULT '0',
+ `last_used` int(10) unsigned NOT NULL DEFAULT '0',
`last_topic` text NOT NULL,
`last_topic_setter` text NOT NULL,
- `last_topic_time` int(10) unsigned NOT NULL default '0',
+ `last_topic_time` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
`forbidby` text NOT NULL,
`forbidreason` text NOT NULL,
- `bantype` smallint(6) NOT NULL default '0',
+ `bantype` smallint(6) NOT NULL DEFAULT '0',
`mlock_on` text NOT NULL,
`mlock_off` text NOT NULL,
`mlock_params` text NOT NULL,
`entry_message` text NOT NULL,
- `memomax` smallint(5) unsigned NOT NULL default '0',
- `botnick` varchar(255) NOT NULL default '',
+ `memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
+ `botnick` varchar(255) NOT NULL DEFAULT '',
`botflags` text NOT NULL,
- `capsmin` smallint(6) NOT NULL default '0',
- `capspercent` smallint(6) NOT NULL default '0',
- `floodlines` smallint(6) NOT NULL default '0',
- `floodsecs` smallint(6) NOT NULL default '0',
- `repeattimes` smallint(6) NOT NULL default '0',
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `capsmin` smallint(6) NOT NULL DEFAULT '0',
+ `capspercent` smallint(6) NOT NULL DEFAULT '0',
+ `floodlines` smallint(6) NOT NULL DEFAULT '0',
+ `floodsecs` smallint(6) NOT NULL DEFAULT '0',
+ `repeattimes` smallint(6) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -119,12 +129,12 @@ CREATE TABLE IF NOT EXISTS `anope_cs_info` (
-- Table structure for table `anope_cs_info_metadata`
--
-DROP TABLE IF EXISTS `anope_cs_info_metadata`;
CREATE TABLE IF NOT EXISTS `anope_cs_info_metadata` (
- `channel` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
- `value` text NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
+ `value` text NOT NULL,
+ KEY `FK_anope_cs_info_metadata_channel` (`channel`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -132,13 +142,12 @@ CREATE TABLE IF NOT EXISTS `anope_cs_info_metadata` (
-- Table structure for table `anope_cs_levels`
--
-DROP TABLE IF EXISTS `anope_cs_levels`;
CREATE TABLE IF NOT EXISTS `anope_cs_levels` (
- `channel` varchar(255) NOT NULL default '',
- `position` int(11) NOT NULL default '0',
- `level` int(11) NOT NULL default '0',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `position` int(11) NOT NULL DEFAULT '0',
+ `level` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`position`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -146,13 +155,12 @@ CREATE TABLE IF NOT EXISTS `anope_cs_levels` (
-- Table structure for table `anope_cs_ttb`
--
-DROP TABLE IF EXISTS `anope_cs_ttb`;
CREATE TABLE IF NOT EXISTS `anope_cs_ttb` (
- `channel` varchar(255) NOT NULL default '',
- `ttb_id` int(11) NOT NULL default '0',
- `value` int(11) NOT NULL default '0',
+ `channel` varchar(255) NOT NULL DEFAULT '',
+ `ttb_id` int(11) NOT NULL DEFAULT '0',
+ `value` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`ttb_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -160,10 +168,9 @@ CREATE TABLE IF NOT EXISTS `anope_cs_ttb` (
-- Table structure for table `anope_extra`
--
-DROP TABLE IF EXISTS `anope_extra`;
CREATE TABLE IF NOT EXISTS `anope_extra` (
`data` text NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -171,11 +178,10 @@ CREATE TABLE IF NOT EXISTS `anope_extra` (
-- Table structure for table `anope_info`
--
-DROP TABLE IF EXISTS `anope_info`;
CREATE TABLE IF NOT EXISTS `anope_info` (
- `version` int(11) default NULL,
- `date` datetime default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `version` int(11) DEFAULT NULL,
+ `date` datetime DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -183,16 +189,16 @@ CREATE TABLE IF NOT EXISTS `anope_info` (
-- Table structure for table `anope_ms_info`
--
-DROP TABLE IF EXISTS `anope_ms_info`;
CREATE TABLE IF NOT EXISTS `anope_ms_info` (
`receiver` varchar(255) NOT NULL,
- `number` int(11) NOT NULL default '0',
- `flags` int(11) NOT NULL default '0',
- `time` int(10) unsigned NOT NULL default '0',
+ `number` int(11) NOT NULL DEFAULT '0',
+ `flags` int(11) NOT NULL DEFAULT '0',
+ `time` int(10) unsigned NOT NULL DEFAULT '0',
`sender` text NOT NULL,
`text` blob NOT NULL,
- `serv` enum('NICK','CHAN') NOT NULL default 'NICK'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `serv` enum('NICK','CHAN') NOT NULL DEFAULT 'NICK',
+ KEY `FK_anope_ms_info_receiver` (`receiver`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -200,11 +206,11 @@ CREATE TABLE IF NOT EXISTS `anope_ms_info` (
-- Table structure for table `anope_ns_access`
--
-DROP TABLE IF EXISTS `anope_ns_access`;
CREATE TABLE IF NOT EXISTS `anope_ns_access` (
- `display` varchar(255) NOT NULL default '',
- `access` varchar(160) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `display` varchar(255) NOT NULL DEFAULT '',
+ `access` varchar(160) NOT NULL,
+ KEY `FK_anope_ns_access_display` (`display`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -212,18 +218,18 @@ CREATE TABLE IF NOT EXISTS `anope_ns_access` (
-- Table structure for table `anope_ns_alias`
--
-DROP TABLE IF EXISTS `anope_ns_alias`;
CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
- `nick` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
`last_quit` text NOT NULL,
`last_realname` text NOT NULL,
`last_usermask` text NOT NULL,
- `time_registered` int(10) unsigned NOT NULL default '0',
- `last_seen` int(10) unsigned NOT NULL default '0',
+ `time_registered` int(10) unsigned NOT NULL DEFAULT '0',
+ `last_seen` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
- `display` varchar(255) NOT NULL default '',
- PRIMARY KEY (`nick`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `display` varchar(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (`nick`),
+ KEY `FK_anope_ns_alias_display` (`display`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -231,13 +237,13 @@ CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
-- Table structure for table `anope_ns_alias_metadata`
--
-DROP TABLE IF EXISTS `anope_ns_alias_metadata`;
CREATE TABLE IF NOT EXISTS `anope_ns_alias_metadata` (
- `nick` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL,
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ PRIMARY KEY (`name`),
+ KEY `FK_anope_ns_alias_metadata_nick` (`nick`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -245,18 +251,17 @@ CREATE TABLE IF NOT EXISTS `anope_ns_alias_metadata` (
-- Table structure for table `anope_ns_core`
--
-DROP TABLE IF EXISTS `anope_ns_core`;
CREATE TABLE IF NOT EXISTS `anope_ns_core` (
- `display` varchar(255) NOT NULL default '',
+ `display` varchar(255) NOT NULL DEFAULT '',
`pass` text NOT NULL,
`email` text NOT NULL,
`greet` text NOT NULL,
`flags` text NOT NULL,
- `language` smallint(5) unsigned NOT NULL default '0',
- `channelcount` smallint(5) unsigned NOT NULL default '0',
- `memomax` smallint(5) unsigned NOT NULL default '0',
- PRIMARY KEY (`display`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `language` smallint(5) unsigned NOT NULL DEFAULT '0',
+ `channelcount` smallint(5) unsigned NOT NULL DEFAULT '0',
+ `memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`display`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -264,13 +269,12 @@ CREATE TABLE IF NOT EXISTS `anope_ns_core` (
-- Table structure for table `anope_ns_core_metadata`
--
-DROP TABLE IF EXISTS `anope_ns_core_metadata`;
CREATE TABLE IF NOT EXISTS `anope_ns_core_metadata` (
- `nick` varchar(255) NOT NULL default '',
- `name` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
+ `name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL,
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ PRIMARY KEY (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -278,15 +282,14 @@ CREATE TABLE IF NOT EXISTS `anope_ns_core_metadata` (
-- Table structure for table `anope_ns_request`
--
-DROP TABLE IF EXISTS `anope_ns_request`;
CREATE TABLE IF NOT EXISTS `anope_ns_request` (
- `nick` varchar(255) NOT NULL default '',
+ `nick` varchar(255) NOT NULL DEFAULT '',
`passcode` text NOT NULL,
`password` text NOT NULL,
`email` text NOT NULL,
- `requested` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`nick`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `requested` int(10) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (`nick`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -294,15 +297,14 @@ CREATE TABLE IF NOT EXISTS `anope_ns_request` (
-- Table structure for table `anope_os_akills`
--
-DROP TABLE IF EXISTS `anope_os_akills`;
CREATE TABLE IF NOT EXISTS `anope_os_akills` (
`user` varchar(255) NOT NULL,
`host` varchar(255) NOT NULL,
`xby` text NOT NULL,
`reason` text NOT NULL,
- `seton` int(10) unsigned NOT NULL default '0',
- `expire` int(10) unsigned NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `seton` int(10) unsigned NOT NULL DEFAULT '0',
+ `expire` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -310,15 +312,14 @@ CREATE TABLE IF NOT EXISTS `anope_os_akills` (
-- Table structure for table `anope_os_core`
--
-DROP TABLE IF EXISTS `anope_os_core`;
CREATE TABLE IF NOT EXISTS `anope_os_core` (
- `maxusercnt` int(11) NOT NULL default '0',
- `maxusertime` int(10) unsigned NOT NULL default '0',
- `akills_count` int(11) NOT NULL default '0',
- `snlines_count` int(11) NOT NULL default '0',
- `sqlines_count` int(11) NOT NULL default '0',
- `szlines_count` int(11) NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `maxusercnt` int(11) NOT NULL DEFAULT '0',
+ `maxusertime` int(10) unsigned NOT NULL DEFAULT '0',
+ `akills_count` int(11) NOT NULL DEFAULT '0',
+ `snlines_count` int(11) NOT NULL DEFAULT '0',
+ `sqlines_count` int(11) NOT NULL DEFAULT '0',
+ `szlines_count` int(11) NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -326,15 +327,14 @@ CREATE TABLE IF NOT EXISTS `anope_os_core` (
-- Table structure for table `anope_os_exceptions`
--
-DROP TABLE IF EXISTS `anope_os_exceptions`;
CREATE TABLE IF NOT EXISTS `anope_os_exceptions` (
`mask` varchar(255) NOT NULL,
- `slimit` int(11) NOT NULL default '0',
+ `slimit` int(11) NOT NULL DEFAULT '0',
`who` text NOT NULL,
`reason` text NOT NULL,
- `time` int(10) unsigned NOT NULL default '0',
- `expires` int(10) unsigned NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `time` int(10) unsigned NOT NULL DEFAULT '0',
+ `expires` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@@ -342,13 +342,93 @@ CREATE TABLE IF NOT EXISTS `anope_os_exceptions` (
-- Table structure for table `anope_os_xlines`
--
-DROP TABLE IF EXISTS `anope_os_xlines`;
CREATE TABLE IF NOT EXISTS `anope_os_xlines` (
`type` varchar(20) NOT NULL,
`mask` varchar(255) NOT NULL,
`xby` text NOT NULL,
`reason` text NOT NULL,
- `seton` int(10) unsigned NOT NULL default '0',
- `expire` int(10) unsigned NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `seton` int(10) unsigned NOT NULL DEFAULT '0',
+ `expire` int(10) unsigned NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `anope_bs_badwords`
+--
+ALTER TABLE `anope_bs_badwords`
+ ADD CONSTRAINT `FK_anope_bs_badwords_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_bs_info_metadata`
+--
+ALTER TABLE `anope_bs_info_metadata`
+ ADD CONSTRAINT `FK_anope_bs_info_metadata_botname` FOREIGN KEY (`botname`) REFERENCES `anope_bs_core` (`nick`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_access`
+--
+ALTER TABLE `anope_cs_access`
+ ADD CONSTRAINT `FK_anope_cs_access_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_akick`
+--
+ALTER TABLE `anope_cs_akick`
+ ADD CONSTRAINT `FK_anope_cs_akick_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_info_metadata`
+--
+ALTER TABLE `anope_cs_info_metadata`
+ ADD CONSTRAINT `FK_anope_cs_info_metadata_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_levels`
+--
+ALTER TABLE `anope_cs_levels`
+ ADD CONSTRAINT `FK_anope_cs_levels_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_cs_ttb`
+--
+ALTER TABLE `anope_cs_ttb`
+ ADD CONSTRAINT `FK_anope_cs_ttb_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON
+UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ms_info`
+--
+ALTER TABLE `anope_ms_info`
+ ADD CONSTRAINT `FK_anope_ms_info_receiver` FOREIGN KEY (`receiver`) REFERENCES `anope_ns_alias` (`nick`) ON DELETE CASCADE
+ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ns_access`
+--
+ALTER TABLE `anope_ns_access`
+ ADD CONSTRAINT `FK_anope_ns_access_display` FOREIGN KEY (`display`) REFERENCES `anope_ns_core` (`display`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ns_alias`
+--
+ALTER TABLE `anope_ns_alias`
+ ADD CONSTRAINT `FK_anope_ns_alias_display` FOREIGN KEY (`display`) REFERENCES `anope_ns_core` (`display`) ON DELETE
+CASCADE ON UPDATE CASCADE;
+
+--
+-- Constraints for table `anope_ns_alias_metadata`
+--
+ALTER TABLE `anope_ns_alias_metadata`
+ ADD CONSTRAINT `FK_anope_ns_alias_metadata_nick` FOREIGN KEY (`nick`) REFERENCES `anope_ns_alias` (`nick`) ON DELETE
+CASCADE ON UPDATE CASCADE;
diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp
index f50d2630e..b9572ac6b 100644
--- a/modules/extra/db_mysql.cpp
+++ b/modules/extra/db_mysql.cpp
@@ -907,7 +907,7 @@ class DBMySQL : public Module
{
this->RunQuery("TRUNCATE TABLE `anope_os_core`");
- this->RunQuery("INSERT DELAYED INTO `anope_os_core` (maxusercnt, maxusertime, akills_count, snlines_count, sqlines_count, szlines_count) VALUES( " + stringify(maxusercnt) + ", " + stringify(maxusertime) + ", " + stringify(SGLine ? SGLine->GetCount() : 0) + ", " + stringify(SQLine ? SQLine->GetCount() : 0) + ", " + stringify(SNLine ? SNLine->GetCount() : 0) + ", " + stringify(SZLine ? SZLine->GetCount() : 0) + ")");
+ this->RunQuery("INSERT INTO `anope_os_core` (maxusercnt, maxusertime, akills_count, snlines_count, sqlines_count, szlines_count) VALUES( " + stringify(maxusercnt) + ", " + stringify(maxusertime) + ", " + stringify(SGLine ? SGLine->GetCount() : 0) + ", " + stringify(SQLine ? SQLine->GetCount() : 0) + ", " + stringify(SNLine ? SNLine->GetCount() : 0) + ", " + stringify(SZLine ? SZLine->GetCount() : 0) + ")");
for (nickcore_map::const_iterator it = NickCoreList.begin(), it_end = NickCoreList.end(); it != it_end; ++it)
{
CurCore = it->second;
@@ -932,7 +932,7 @@ class DBMySQL : public Module
FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteBotMetadata, CurBot));
/* This is for the core bots, bots added by users are already handled by an event */
- this->RunQuery("INSERT DELAYED INTO `anope_bs_core` (nick, user, host, rname, flags, created, chancount) VALUES('" + this->Escape(CurBot->nick) + "', '" + this->Escape(CurBot->GetIdent()) + "', '" + this->Escape(CurBot->host) + "', '" + this->Escape(CurBot->realname) + "', '" + GetBotServFlags(CurBot) + "', " + stringify(CurBot->created) + ", " + stringify(CurBot->chancount) + ") ON DUPLICATE KEY UPDATE nick=VALUES(nick), user=VALUES(user), host=VALUES(host), rname=VALUES(rname), flags=VALUES(flags), created=VALUES(created), chancount=VALUES(chancount)");
+ this->RunQuery("INSERT INTO `anope_bs_core` (nick, user, host, rname, flags, created, chancount) VALUES('" + this->Escape(CurBot->nick) + "', '" + this->Escape(CurBot->GetIdent()) + "', '" + this->Escape(CurBot->host) + "', '" + this->Escape(CurBot->realname) + "', '" + GetBotServFlags(CurBot) + "', " + stringify(CurBot->created) + ", " + stringify(CurBot->chancount) + ") ON DUPLICATE KEY UPDATE nick=VALUES(nick), user=VALUES(user), host=VALUES(host), rname=VALUES(rname), flags=VALUES(flags), created=VALUES(created), chancount=VALUES(chancount)");
}
this->RunQuery("TRUNCATE TABLE `anope_extra`");
@@ -1029,7 +1029,7 @@ class DBMySQL : public Module
{
for (int i = 0; i < TTB_SIZE; ++i)
{
- this->RunQuery("INSERT DELAYED INTO `anope_cs_ttb` (channel, ttb_id, value) VALUES('" + this->Escape(ci->name) + "', " + stringify(i) + ", " + stringify(ci->ttb[i]) + ") ON DUPLICATE KEY UPDATE channel=VALUES(channel), ttb_id=VALUES(ttb_id), value=VALUES(value)");
+ this->RunQuery("INSERT INTO `anope_cs_ttb` (channel, ttb_id, value) VALUES('" + this->Escape(ci->name) + "', " + stringify(i) + ", " + stringify(ci->ttb[i]) + ") ON DUPLICATE KEY UPDATE channel=VALUES(channel), ttb_id=VALUES(ttb_id), value=VALUES(value)");
}
this->RunQuery("UPDATE `anope_cs_info` SET `botflags` = '" + GetBotFlags(ci->botflags) + "' WHERE `name` = '" + this->Escape(ci->name) + "'");
@@ -1072,7 +1072,7 @@ class DBMySQL : public Module
void OnNickAddAccess(NickCore *nc, const Anope::string &entry)
{
- this->RunQuery("INSERT DELAYED INTO `anope_ns_access` (display, access) VALUES('" + this->Escape(nc->display) + "', '" + this->Escape(entry) + "')");
+ this->RunQuery("INSERT INTO `anope_ns_access` (display, access) VALUES('" + this->Escape(nc->display) + "', '" + this->Escape(entry) + "')");
}
void OnNickEraseAccess(NickCore *nc, const Anope::string &entry)
@@ -1087,12 +1087,7 @@ class DBMySQL : public Module
void OnDelCore(NickCore *nc)
{
- this->RunQuery("DELETE FROM `anope_cs_access` WHERE `display` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("DELETE FROM `anope_cs_akick` WHERE `mask` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("DELETE FROM `anope_ns_access` WHERE `display` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("DELETE FROM `anope_ns_alias` WHERE `display` = '" + this->Escape(nc->display) + "'");
this->RunQuery("DELETE FROM `anope_ns_core` WHERE `display` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("DELETE FROM `anope_ms_info` WHERE `receiver` = '" + this->Escape(nc->display) + "'");
}
void OnNickForbidden(NickAlias *na)
@@ -1107,7 +1102,7 @@ class DBMySQL : public Module
void OnMakeNickRequest(NickRequest *nr)
{
- this->RunQuery("INSERT DELAYED INTO `anope_ns_request` (nick, passcode, password, email, requested) VALUES('" + this->Escape(nr->nick) + "', '" + this->Escape(nr->passcode) + "', '" + this->Escape(nr->password) + "', '" + this->Escape(nr->email) + "', " + stringify(nr->requested) + ")");
+ this->RunQuery("INSERT INTO `anope_ns_request` (nick, passcode, password, email, requested) VALUES('" + this->Escape(nr->nick) + "', '" + this->Escape(nr->passcode) + "', '" + this->Escape(nr->password) + "', '" + this->Escape(nr->email) + "', " + stringify(nr->requested) + ")");
}
void OnDelNickRequest(NickRequest *nr)
@@ -1117,7 +1112,7 @@ class DBMySQL : public Module
void InsertAlias(NickAlias *na)
{
- this->RunQuery("INSERT DELAYED INTO `anope_ns_alias` (nick, last_quit, last_realname, last_usermask, time_registered, last_seen, flags, display) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_ns_alias` (nick, last_quit, last_realname, last_usermask, time_registered, last_seen, flags, display) VALUES('" +
this->Escape(na->nick) + "', '" + this->Escape(na->last_quit) + "', '" +
this->Escape(na->last_realname) + "', '" + this->Escape(na->last_usermask) + "', " + stringify(na->time_registered) + ", " + stringify(na->last_seen) +
", '" + BuildFlagsList(na) + "', '" + this->Escape(na->nc->display) + "') " + "ON DUPLICATE KEY UPDATE last_quit=VALUES(last_quit), "
@@ -1127,7 +1122,7 @@ class DBMySQL : public Module
void InsertCore(NickCore *nc)
{
- this->RunQuery("INSERT DELAYED INTO `anope_ns_core` (display, pass, email, greet, flags, language, channelcount, memomax) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_ns_core` (display, pass, email, greet, flags, language, channelcount, memomax) VALUES('" +
this->Escape(nc->display) + "', '" + this->Escape(nc->pass) + "', '" +
this->Escape(nc->email) + "', '" + this->Escape(nc->greet) + "', '" +
BuildFlagsList(nc) + "', " + stringify(nc->language) + ", " + stringify(nc->channelcount) + ", " +
@@ -1138,19 +1133,13 @@ class DBMySQL : public Module
void OnNickRegister(NickAlias *na)
{
- this->InsertAlias(na);
this->InsertCore(na->nc);
+ this->InsertAlias(na);
}
void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay)
{
this->RunQuery("UPDATE `anope_ns_core` SET `display` = '" + this->Escape(newdisplay) + "' WHERE `display` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("UPDATE `anope_ns_alias` SET `display` = '" + this->Escape(newdisplay) + "' WHERE `display` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("UPDATE `anope_ns_access` SET `display` = '" + this->Escape(newdisplay) + "' WHERE `display` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("UPDATE `anope_cs_access` SET `display` = '" + this->Escape(newdisplay) + "' WHERE `display` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("UPDATE `anope_cs_info` SET `founder` = '" + this->Escape(newdisplay) + "' WHERE `founder` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("UPDATE `anope_cs_info` SET `successor` = '" + this->Escape(newdisplay) + "' WHERE `successor` = '" + this->Escape(nc->display) + "'");
- this->RunQuery("UPDATE `anope_ms_info` SET `receiver` = '" + this->Escape(newdisplay) + "' WHERE `receiver` = '" + this->Escape(nc->display) + "'");
}
void OnNickSuspend(NickAlias *na)
@@ -1158,9 +1147,9 @@ class DBMySQL : public Module
this->RunQuery("UPDATE `anope_ns_core` SET `flags` = '" + BuildFlagsList(na->nc) + "' WHERE `display` = '" + this->Escape(na->nc->display) + "'");
}
- void OnAccessAdd(ChannelInfo *ci, User *u, NickAlias *na, int level)
+ void OnAccessAdd(ChannelInfo *ci, User *u, NickCore *nc, int level)
{
- this->RunQuery("INSERT DELAYED INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(na->nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(Anope::CurTime) + ", '" + this->Escape(u->nick) + "')");
+ this->RunQuery("INSERT INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(Anope::CurTime) + ", '" + this->Escape(u->nick) + "')");
}
void OnAccessDel(ChannelInfo *ci, User *u, NickCore *nc)
@@ -1170,7 +1159,7 @@ class DBMySQL : public Module
void OnAccessChange(ChannelInfo *ci, User *u, NickAlias *na, int level)
{
- this->RunQuery("INSERT DELAYED INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(na->nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(Anope::CurTime) + ", '" + this->Escape(u->nick) + "') ON DUPLICATE KEY UPDATE level=VALUES(level), display=VALUES(display), channel=VALUES(channel), last_seen=VALUES(last_seen), creator=VALUES(creator)");
+ this->RunQuery("INSERT INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(na->nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(Anope::CurTime) + ", '" + this->Escape(u->nick) + "') ON DUPLICATE KEY UPDATE level=VALUES(level), display=VALUES(display), channel=VALUES(channel), last_seen=VALUES(last_seen), creator=VALUES(creator)");
}
void OnAccessClear(ChannelInfo *ci, User *u)
@@ -1189,25 +1178,20 @@ class DBMySQL : public Module
void OnChanForbidden(ChannelInfo *ci)
{
- this->RunQuery("INSERT DELAYED INTO `anope_cs_info` (name, time_registered, last_used, flags, forbidby, forbidreason) VALUES ('" +
+ this->RunQuery("INSERT INTO `anope_cs_info` (name, time_registered, last_used, flags, forbidby, forbidreason) VALUES ('" +
this->Escape(ci->name) + "', " + stringify(ci->time_registered) + ", " + stringify(ci->last_used) + ", '" + BuildFlagsList(ci) + "', '" + this->Escape(ci->forbidby) + "', '"
+ this->Escape(ci->forbidreason) + "')");
}
void OnDelChan(ChannelInfo *ci)
{
- this->Escape("DELETE FROM `anope_cs_access` WHERE `channel` = '" + this->Escape(ci->name) + "'");
- this->Escape("DELETE FROM `anope_cs_akick` WHERE `channel` = '" + this->Escape(ci->name) + "'");
- this->Escape("DELETE FROM `anope_cs_info` WHERE `name` = '" + this->Escape(ci->name) + "'");
- this->Escape("DELETE FROM `anope_cs_levels` WHERE `channel` = '" + this->Escape(ci->name) + "'");
- this->Escape("DELETE From `anope_cs_ttb` WHERE `channel` = '" + this->Escape(ci->name) + "'");
- this->Escape("DELETE FROM `anope_bs_badwords` WHERE `channel` = '" + this->Escape(ci->name) + "'");
+ this->RunQuery("DELETE FROM `anope_cs_info` WHERE `name` = '" + this->Escape(ci->name) + "'");
}
void OnChanRegistered(ChannelInfo *ci)
{
Anope::string flags = BuildFlagsList(ci), mlockon = GetMLockOn(ci), mlockoff = GetMLockOff(ci), mlockparams = GetMLockParams(ci);
- this->RunQuery("INSERT DELAYED INTO `anope_cs_info` (name, founder, successor, descr, time_registered, last_used, last_topic, last_topic_setter, last_topic_time, flags, forbidby, forbidreason, bantype, mlock_on, mlock_off, mlock_params, entry_message, memomax, botnick, botflags, capsmin, capspercent, floodlines, floodsecs, repeattimes) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_cs_info` (name, founder, successor, descr, time_registered, last_used, last_topic, last_topic_setter, last_topic_time, flags, forbidby, forbidreason, bantype, mlock_on, mlock_off, mlock_params, entry_message, memomax, botnick, botflags, capsmin, capspercent, floodlines, floodsecs, repeattimes) VALUES('" +
this->Escape(ci->name) + "', '" + this->Escape(ci->founder ? ci->founder->display : "") + "', '" +
this->Escape(ci->successor ? ci->successor->display : "") + "', '" + this->Escape(ci->desc) + "', " +
stringify(ci->time_registered) + ", " + stringify(ci->last_used) + ", '" + this->Escape(ci->last_topic) + "', '" +
@@ -1228,7 +1212,7 @@ class DBMySQL : public Module
void OnAkickAdd(ChannelInfo *ci, AutoKick *ak)
{
- this->RunQuery("INSERT DELAYED INTO `anope_cs_akick` (channel, flags, mask, reason, creator, created, last_used) VALUES('" + this->Escape(ci->name) + "', '" +
+ this->RunQuery("INSERT INTO `anope_cs_akick` (channel, flags, mask, reason, creator, created, last_used) VALUES('" + this->Escape(ci->name) + "', '" +
(ak->HasFlag(AK_ISNICK) ? "ISNICK " : "") + (ak->HasFlag(AK_STUCK) ? "STUCK " : "") + "', '" +
this->Escape(ak->HasFlag(AK_ISNICK) ? ak->nc->display : ak->mask) + "', '" + this->Escape(ak->reason) + "', '" +
this->Escape(ak->creator) + "', " + stringify(ak->addtime) + ", " + stringify(ak->last_used) + ")");
@@ -1241,7 +1225,7 @@ class DBMySQL : public Module
void OnBotCreate(BotInfo *bi)
{
- this->RunQuery("INSERT DELAYED INTO `anope_bs_core` (nick, user, host, rname, flags, created, chancount) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_bs_core` (nick, user, host, rname, flags, created, chancount) VALUES('" +
this->Escape(bi->nick) + "', '" + this->Escape(bi->GetIdent()) + "', '" + this->Escape(bi->host) + "', '" +
this->Escape(bi->realname) + "', '" + GetBotServFlags(bi) + "', " + stringify(bi->created) + ", " + stringify(bi->chancount) + ") " +
"ON DUPLICATE KEY UPDATE nick=VALUES(nick), user=VALUES(user), host=VALUES(host), rname=VALUES(rname), flags=VALUES(flags), created=VALUES(created), chancount=VALUES(chancount)");
@@ -1254,7 +1238,6 @@ class DBMySQL : public Module
void OnBotDelete(BotInfo *bi)
{
- this->RunQuery("DELETE FROM `anope_bs_core` WHERE `nick` = '" + this->Escape(bi->nick) + "'");
this->RunQuery("UPDATE `anope_cs_info` SET `botnick` = '' WHERE `botnick` = '" + this->Escape(bi->nick) + "'");
}
@@ -1272,7 +1255,7 @@ class DBMySQL : public Module
void OnBadWordAdd(ChannelInfo *ci, BadWord *bw)
{
- Anope::string query = "INSERT DELAYED INTO `anope_bs_badwords` (channel, word, type) VALUES('" + this->Escape(ci->name) + "', '" + this->Escape(bw->word) + "', '";
+ Anope::string query = "INSERT INTO `anope_bs_badwords` (channel, word, type) VALUES('" + this->Escape(ci->name) + "', '" + this->Escape(bw->word) + "', '";
switch (bw->type)
{
case BW_SINGLE:
@@ -1314,14 +1297,14 @@ class DBMySQL : public Module
void OnMemoSend(User *, NickCore *nc, Memo *m)
{
- this->RunQuery("INSERT DELAYED INTO `anope_ms_info` (receiver, number, flags, time, sender, text, serv) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_ms_info` (receiver, number, flags, time, sender, text, serv) VALUES('" +
this->Escape(nc->display) + "', " + stringify(m->number) + ", '" + BuildFlagsList(m) + "', " + stringify(m->time) + ", '" +
this->Escape(m->sender) + "', '" + this->Escape(m->text) + "', 'NICK')");
}
void OnMemoSend(User *, ChannelInfo *ci, Memo *m)
{
- this->RunQuery("INSERT DELAYED INTO `anope_ms_info` (receiver, number, flags, time, sender, text, serv) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_ms_info` (receiver, number, flags, time, sender, text, serv) VALUES('" +
this->Escape(ci->name) + "', " + stringify(m->number) + ", '" + BuildFlagsList(m) + "', " + stringify(m->time) + ", '" +
this->Escape(m->sender) + "', '" + this->Escape(m->text) + "', 'CHAN')");
}
@@ -1344,7 +1327,7 @@ class DBMySQL : public Module
EventReturn OnAddAkill(User *, XLine *ak)
{
- this->RunQuery("INSERT DELAYED INTO `anope_os_akills` (user, host, xby, reason, seton, expire) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_os_akills` (user, host, xby, reason, seton, expire) VALUES('" +
this->Escape(ak->GetUser()) + "', '" + this->Escape(ak->GetHost()) + "', '" + this->Escape(ak->By) + "', '" +
this->Escape(ak->Reason) + "', " + stringify(ak->Created) + ", " + stringify(ak->Expires) + ")");
return EVENT_CONTINUE;
@@ -1360,7 +1343,7 @@ class DBMySQL : public Module
EventReturn OnExceptionAdd(User *, Exception *ex)
{
- this->RunQuery("INSERT DELAYED INTO `anope_os_exceptions` (mask, slimit, who, reason, time, expires) VALUES('" +
+ this->RunQuery("INSERT INTO `anope_os_exceptions` (mask, slimit, who, reason, time, expires) VALUES('" +
this->Escape(ex->mask) + "', " + stringify(ex->limit) + ", '" + this->Escape(ex->who) + "', '" + this->Escape(ex->reason) + "', " +
stringify(ex->time) + ", " + stringify(ex->expires) + ")");
return EVENT_CONTINUE;
@@ -1373,7 +1356,7 @@ class DBMySQL : public Module
EventReturn OnAddXLine(User *, XLine *x, XLineType Type)
{
- this->RunQuery(Anope::string("INSERT DELAYED INTO `anope_os_sxlines` (type, mask, xby, reason, seton, expire) VALUES('") +
+ this->RunQuery(Anope::string("INSERT INTO `anope_os_sxlines` (type, mask, xby, reason, seton, expire) VALUES('") +
(Type == X_SNLINE ? "SNLINE" : (Type == X_SQLINE ? "SQLINE" : "SZLINE")) + "', '" +
this->Escape(x->Mask) + "', '" + this->Escape(x->By) + "', '" + this->Escape(x->Reason) + "', " +
stringify(x->Created) + ", " + stringify(x->Expires) + ")");
@@ -1406,7 +1389,7 @@ void MySQLInterface::OnError(const SQLResult &r)
static void Write(const Anope::string &data)
{
- me->RunQuery("INSERT DELAYED INTO `anope_extra` (data) VALUES('" + me->Escape(data) + "')");
+ me->RunQuery("INSERT INTO `anope_extra` (data) VALUES('" + me->Escape(data) + "')");
}
static void WriteNickMetadata(const Anope::string &key, const Anope::string &data)
@@ -1414,7 +1397,7 @@ static void WriteNickMetadata(const Anope::string &key, const Anope::string &dat
if (!CurNick)
throw CoreException(Anope::string("WriteNickMetadata without a nick to write"));
- me->RunQuery("INSERT DELAYED INTO `anope_ns_alias_metadata` (nick, name, value) VALUES('" + me->Escape(CurNick->nick) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
+ me->RunQuery("INSERT INTO `anope_ns_alias_metadata` (nick, name, value) VALUES('" + me->Escape(CurNick->nick) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
}
static void WriteCoreMetadata(const Anope::string &key, const Anope::string &data)
@@ -1422,7 +1405,7 @@ static void WriteCoreMetadata(const Anope::string &key, const Anope::string &dat
if (!CurCore)
throw CoreException(Anope::string("WritCoreMetadata without a core to write"));
- me->RunQuery("INSERT DELAYED INTO `anope_ns_core_metadata` (nick, name, value) VALUES('" + me->Escape(CurCore->display) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
+ me->RunQuery("INSERT INTO `anope_ns_core_metadata` (nick, name, value) VALUES('" + me->Escape(CurCore->display) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
}
static void WriteChannelMetadata(const Anope::string &key, const Anope::string &data)
@@ -1430,7 +1413,7 @@ static void WriteChannelMetadata(const Anope::string &key, const Anope::string &
if (!CurChannel)
throw CoreException(Anope::string("WriteChannelMetadata without a channel to write"));
- me->RunQuery("INSERT DELAYED INTO `anope_cs_info_metadata` (channel, name, value) VALUES('" + me->Escape(CurChannel->name) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
+ me->RunQuery("INSERT INTO `anope_cs_info_metadata` (channel, name, value) VALUES('" + me->Escape(CurChannel->name) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
}
static void WriteBotMetadata(const Anope::string &key, const Anope::string &data)
@@ -1438,7 +1421,7 @@ static void WriteBotMetadata(const Anope::string &key, const Anope::string &data
if (!CurBot)
throw CoreException(Anope::string("WriteBotMetadata without a bot to write"));
- me->RunQuery("INSERT DELAYED INTO `anope_bs_info_metadata` (botname, name, value) VALUES('" + me->Escape(CurBot->nick) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
+ me->RunQuery("INSERT INTO `anope_bs_info_metadata` (botname, name, value) VALUES('" + me->Escape(CurBot->nick) + "', '" + me->Escape(key) + "', '" + me->Escape(data) + "')");
}
static void SaveDatabases()
@@ -1457,7 +1440,7 @@ static void SaveDatabases()
for (std::vector<Anope::string>::iterator it = nc->access.begin(), it_end = nc->access.end(); it != it_end; ++it)
{
- me->RunQuery("INSERT DELAYED INTO `anope_ns_access` (display, access) VALUES(" + me->Escape(nc->display) + ", " + me->Escape(*it) + ")");
+ me->RunQuery("INSERT INTO `anope_ns_access` (display, access) VALUES(" + me->Escape(nc->display) + ", " + me->Escape(*it) + ")");
}
for (unsigned j = 0, end = nc->memos.memos.size(); j < end; ++j)
@@ -1499,7 +1482,7 @@ static void SaveDatabases()
{
ChanAccess *access = ci->GetAccess(j);
- me->RunQuery(Anope::string("INSERT DELAYED INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES('") + access->level + "', " + me->Escape(access->nc->display) + ", " + me->Escape(ci->name) + ", " + access->last_seen + ", " + me->Escape(access->creator) + ") ON DUPLICATE KEY UPDATE level=VALUES(level), last_seen=VALUES(last_seen), creator=VALUES(creator)");
+ me->RunQuery(Anope::string("INSERT INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES('") + access->level + "', " + me->Escape(access->nc->display) + ", " + me->Escape(ci->name) + ", " + access->last_seen + ", " + me->Escape(access->creator) + ") ON DUPLICATE KEY UPDATE level=VALUES(level), last_seen=VALUES(last_seen), creator=VALUES(creator)");
}
for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j)
@@ -1511,7 +1494,7 @@ static void SaveDatabases()
for (int k = 0; k < CA_SIZE; ++k)
{
- me->RunQuery("INSERT DELAYED INTO `anope_cs_levels` (channel, position, level) VALUES(" + me->Escape(ci->name) + ", '" + stringify(k) + "', '" + stringify(ci->levels[k]) + "') ON DUPLICATE KEY UPDATE position=VALUES(position), level=VALUES(level)");
+ me->RunQuery("INSERT INTO `anope_cs_levels` (channel, position, level) VALUES(" + me->Escape(ci->name) + ", '" + stringify(k) + "', '" + stringify(ci->levels[k]) + "') ON DUPLICATE KEY UPDATE position=VALUES(position), level=VALUES(level)");
}
for (unsigned j = 0, end = ci->memos.memos.size(); j < end; ++j)