0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 23:03:51 +01:00

Fix up sql

This commit is contained in:
Erik Johnston 2017-06-13 11:19:18 +01:00
parent 6fd7e6db3d
commit 505e7e8b9d

View file

@ -171,10 +171,12 @@ class UserDirectoryStore(SQLBaseStore):
|| setweight(to_tsvector('english', COALESCE(?, '')), 'B') || setweight(to_tsvector('english', COALESCE(?, '')), 'B')
) )
""" """
args = ( txn.execute(
user_id, sql,
get_localpart_from_id(user_id), get_domain_from_id(user_id), (
display_name, user_id, get_localpart_from_id(user_id),
get_domain_from_id(user_id), display_name,
)
) )
else: else:
sql = """ sql = """
@ -184,10 +186,12 @@ class UserDirectoryStore(SQLBaseStore):
|| setweight(to_tsvector('english', COALESCE(?, '')), 'B') || setweight(to_tsvector('english', COALESCE(?, '')), 'B')
WHERE user_id = ? WHERE user_id = ?
""" """
args = ( txn.execute(
sql,
(
get_localpart_from_id(user_id), get_domain_from_id(user_id), get_localpart_from_id(user_id), get_domain_from_id(user_id),
display_name, display_name, user_id,
user_id, )
) )
elif isinstance(self.database_engine, Sqlite3Engine): elif isinstance(self.database_engine, Sqlite3Engine):
value = "%s %s" % (user_id, display_name,) if display_name else user_id value = "%s %s" % (user_id, display_name,) if display_name else user_id
@ -202,8 +206,6 @@ class UserDirectoryStore(SQLBaseStore):
# This should be unreachable. # This should be unreachable.
raise Exception("Unrecognized database engine") raise Exception("Unrecognized database engine")
txn.execute(sql, args)
txn.call_after(self.get_user_in_directory.invalidate, (user_id,)) txn.call_after(self.get_user_in_directory.invalidate, (user_id,))
return self.runInteraction( return self.runInteraction(