summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-02-23 11:30:33 +0000
committerGitHub <noreply@github.com>2017-02-23 11:30:33 +0000
commitbf92b7201f3503de25daa2c35afbe5af7b3ef2fb (patch)
treeecf119e388478a855478db7d47c850be5a1d1fc7 /synapse
parentRemove lock from rotate notifs (diff)
parentStrip newlines from SQL queries (diff)
downloadsynapse-bf92b7201f3503de25daa2c35afbe5af7b3ef2fb.tar.xz
Merge pull request #1939 from matrix-org/erikj/strip_sql_newlines
Strip newlines from SQL queries
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/_base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index b0dc391190..557701d0c4 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -80,7 +80,13 @@ class LoggingTransaction(object):
     def executemany(self, sql, *args):
         self._do_execute(self.txn.executemany, sql, *args)
 
+    def _make_sql_one_line(self, sql):
+        "Strip newlines out of SQL so that the loggers in the DB are on one line"
+        return " ".join(l.strip() for l in sql.splitlines() if l.strip())
+
     def _do_execute(self, func, sql, *args):
+        sql = self._make_sql_one_line(sql)
+
         # TODO(paul): Maybe use 'info' and 'debug' for values?
         sql_logger.debug("[SQL] {%s} %s", self.name, sql)