summaryrefslogtreecommitdiff
path: root/modules/extra/db_mysql.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-01-24 19:03:15 -0500
committerAdam <Adam@anope.org>2011-01-24 19:03:15 -0500
commit2a53e5f80e7ffeb26742831fd109dc62a3829a81 (patch)
treed615d162a78590bb6dd02d0bd9f35c23f9342a84 /modules/extra/db_mysql.cpp
parent2e8acfb98c8eb2113eb760ca6959114c7d2950d2 (diff)
Fixed the order queries are done during sqlsync to make the new foreign keys happy
Diffstat (limited to 'modules/extra/db_mysql.cpp')
-rw-r--r--modules/extra/db_mysql.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp
index 1140dffa6..b90ab0834 100644
--- a/modules/extra/db_mysql.cpp
+++ b/modules/extra/db_mysql.cpp
@@ -972,7 +972,7 @@ class DBMySQL : public Module
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) + "', '" +
- ToString(nc->ToString()) + "', " + stringify(nc->language) + ", " + stringify(nc->channelcount) + ", " +
+ ToString(nc->ToString()) + "', '" + this->Escape(nc->language) + "', " + stringify(nc->channelcount) + ", " +
stringify(nc->memos.memomax) + ") " +
"ON DUPLICATE KEY UPDATE pass=VALUES(pass), email=VALUES(email), greet=VALUES(greet), flags=VALUES(flags), language=VALUES(language), " +
"channelcount=VALUES(channelcount), memomax=VALUES(memomax)");
@@ -1283,22 +1283,23 @@ static void WriteBotMetadata(const Anope::string &key, const Anope::string &data
static void SaveDatabases()
{
- me->RunQuery("TRUNCATE TABLE `anope_ns_alias`");
-
- for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it)
- {
- me->InsertAlias(it->second);
- if (it->second->hostinfo.HasVhost())
- me->OnSetVhost(it->second);
- }
-
me->RunQuery("TRUNCATE TABLE `anope_ns_core`");
me->RunQuery("TRUNCATE TABLE `anope_ms_info`");
+ me->RunQuery("TRUNCATE TABLE `anope_ns_alias`");
for (nickcore_map::const_iterator nit = NickCoreList.begin(), nit_end = NickCoreList.end(); nit != nit_end; ++nit)
{
NickCore *nc = nit->second;
+ me->InsertCore(nc);
+
+ for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it)
+ {
+ me->InsertAlias(*it);
+ if ((*it)->hostinfo.HasVhost())
+ me->OnSetVhost(*it);
+ }
+
for (std::vector<Anope::string>::iterator it = nc->access.begin(), it_end = nc->access.end(); it != it_end; ++it)
{
me->RunQuery("INSERT INTO `anope_ns_access` (display, access) VALUES('" + me->Escape(nc->display) + "', '" + me->Escape(*it) + "')");
@@ -1310,11 +1311,8 @@ static void SaveDatabases()
me->OnMemoSend(NULL, nc, m);
}
-
- me->InsertCore(nc);
}
-
me->RunQuery("TRUNCATE TABLE `anope_bs_core`");
for (patricia_tree<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)