summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-11-04 22:56:15 -0400
committerAdam <Adam@anope.org>2016-11-04 22:56:15 -0400
commitac0f3c5ccf9610f38204d5f9f8876657ce6acfb5 (patch)
treef98b3979055f703bfef6e4bcce8238ca7c000c3a
parent76ea11198028b6a1ab4f739d239bf890ce6d937e (diff)
m_mysql: null empty columns instead of setting to ''
-rw-r--r--modules/extra/m_mysql.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp
index 06cce3143..67e43fcdb 100644
--- a/modules/extra/m_mysql.cpp
+++ b/modules/extra/m_mysql.cpp
@@ -446,7 +446,15 @@ Query MySQLService::BuildInsert(const Anope::string &table, unsigned int id, Dat
{
Anope::string buf;
*it->second >> buf;
- query.SetValue(it->first, buf);
+
+ bool escape = true;
+ if (buf.empty())
+ {
+ buf = "NULL";
+ escape = false;
+ }
+
+ query.SetValue(it->first, buf, escape);
}
return query;