summaryrefslogtreecommitdiff
path: root/modules/database/db_sql_live.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-08-24 22:23:04 -0400
committerAdam <Adam@anope.org>2013-08-25 04:48:43 -0400
commit446b3a910d457ce32e6accd4ecc47e6e02f66ed4 (patch)
treed27c3d85a3b65cf5868ea428f3f414244505a52e /modules/database/db_sql_live.cpp
parent8be5f53f1fde1ea84a9f2a6669d78756f4f3ee5a (diff)
Save unconfirmed status and passcodes in the database.
Fix db_sql_live to not reinsert all records if there are extra columns. Plexus has no chmode +r
Diffstat (limited to 'modules/database/db_sql_live.cpp')
-rw-r--r--modules/database/db_sql_live.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/database/db_sql_live.cpp b/modules/database/db_sql_live.cpp
index 7ef0528a8..f74933b98 100644
--- a/modules/database/db_sql_live.cpp
+++ b/modules/database/db_sql_live.cpp
@@ -216,11 +216,13 @@ class DBMySQL : public Module, public Pipe
new_s->id = id;
obj->objects[id] = new_s;
+ /* The Unserialize operation is destructive so rebuild the data for UpdateCache.
+ * Also the old data may contain columns that we don't use, so we reserialize the
+ * object to know for sure our cache is consistent
+ */
+
Data data2;
- /* The Unserialize operation is destructive so rebuild the data for UpdateCache */
- for (std::map<Anope::string, Anope::string>::const_iterator rit = row.begin(), rit_end = row.end(); rit != rit_end; ++rit)
- if (rit->first != "id" && rit->first != "timestamp")
- data2[rit->first] << rit->second;
+ new_s->Serialize(data2);
new_s->UpdateCache(data2); /* We know this is the most up to date copy */
}
}