diff options
author | Adam <Adam@anope.org> | 2012-01-15 01:47:31 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-01-15 01:47:31 -0500 |
commit | 964d63cdacdbc3769b269ae0e6e616f58f0256bc (patch) | |
tree | 7398a51b5bc15e054fb6640b226b26c1e2793eda /modules/database/db_sql_live_write.cpp | |
parent | f38faedbdad404983c0d291b8e0e233a6b0fb70d (diff) |
Improve on db_sql_live_read
Diffstat (limited to 'modules/database/db_sql_live_write.cpp')
-rw-r--r-- | modules/database/db_sql_live_write.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/database/db_sql_live_write.cpp b/modules/database/db_sql_live_write.cpp index 6bb9b93d5..a97f57359 100644 --- a/modules/database/db_sql_live_write.cpp +++ b/modules/database/db_sql_live_write.cpp @@ -85,9 +85,15 @@ class DBMySQL : public Module void Delete(const Anope::string &table, const Serializable::serialized_data &data) { - Anope::string query_text = "DELETE FROM `" + table + "` WHERE "; + Anope::string query_text = "DELETE FROM `" + table + "` WHERE ", arg_text; for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it) - query_text += "`" + it->first + "` = @" + it->first + "@"; + { + if (!arg_text.empty()) + arg_text += " AND "; + arg_text += "`" + it->first + "` = @" + it->first + "@"; + } + + query_text += arg_text; SQLQuery query(query_text); for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it) |