Revert part of 6207399

older sqlite doesn't support indexes on expressions, lets just
store things lowercase in the db
pull/1170/head
David Baker 2016-10-14 16:20:24 +01:00
parent bcb1245a2d
commit 29c5922021
1 changed files with 10 additions and 20 deletions

View File

@ -458,27 +458,17 @@ class RegistrationStore(background_updates.BackgroundUpdateStore):
@defer.inlineCallbacks @defer.inlineCallbacks
def get_user_id_by_threepid(self, medium, address): def get_user_id_by_threepid(self, medium, address):
def f(txn): ret = yield self._simple_select_one(
sql = ( "user_threepids",
"SELECT user_id" {
" FROM user_threepids" "medium": medium,
" WHERE medium = ? AND LOWER(address) = LOWER(?)" "address": address
},
['user_id'], True, 'get_user_id_by_threepid'
) )
txn.execute(sql, (medium, address)) if ret:
row = txn.fetchone() defer.returnValue(ret['user_id'])
if not row: defer.returnValue(None)
return None
if txn.rowcount > 1:
raise StoreError(500, "More than one row matched")
return {
"user_id": row[0]
}
res = yield self.runInteraction(
"get_user_id_by_threepid", f
)
defer.returnValue(res)
def user_delete_threepids(self, user_id): def user_delete_threepids(self, user_id):
return self._simple_delete( return self._simple_delete(