summary refs log tree commit diff
path: root/synapse/storage/database.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-10-20 17:41:11 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2020-10-20 17:41:11 +0100
commitec50c996099af2f23964ca2fbcd0b3ae304e4852 (patch)
tree4e39fd8acb5e467c8ab256a24f5be24fe34343dd /synapse/storage/database.py
parentMerge commit '30426c706' into anoa/dinsic_release_1_21_x (diff)
parentConvert calls of async database methods to async (#8166) (diff)
downloadsynapse-ec50c996099af2f23964ca2fbcd0b3ae304e4852.tar.xz
Merge commit '9b7ac03af' into anoa/dinsic_release_1_21_x
* commit '9b7ac03af':
  Convert calls of async database methods to async (#8166)
  simple_search_list_txn should return None, not 0. (#8187)
  Fix missing _add_persisted_position (#8179)
Diffstat (limited to 'synapse/storage/database.py')
-rw-r--r--synapse/storage/database.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py

index 2f6f49a4bf..ba4c0c9af6 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py
@@ -28,7 +28,6 @@ from typing import ( Optional, Tuple, TypeVar, - Union, overload, ) @@ -1655,7 +1654,7 @@ class DatabasePool(object): term: Optional[str], col: str, retcols: Iterable[str], - ) -> Union[List[Dict[str, Any]], int]: + ) -> Optional[List[Dict[str, Any]]]: """Executes a SELECT query on the named table, which may return zero or more rows, returning the result as a list of dicts. @@ -1667,14 +1666,14 @@ class DatabasePool(object): retcols: the names of the columns to return Returns: - 0 if no term is given, otherwise a list of dictionaries. + None if no term is given, otherwise a list of dictionaries. """ if term: sql = "SELECT %s FROM %s WHERE %s LIKE ?" % (", ".join(retcols), table, col) termvalues = ["%%" + term + "%%"] txn.execute(sql, termvalues) else: - return 0 + return None return cls.cursor_to_dict(txn)