From ac0f3c5ccf9610f38204d5f9f8876657ce6acfb5 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 4 Nov 2016 22:56:15 -0400 Subject: m_mysql: null empty columns instead of setting to '' --- modules/extra/m_mysql.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/extra/m_mysql.cpp') 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; -- cgit