remove unused param on `make_tuple_comparison_clause`
This commit is contained in:
parent
77e56deffc
commit
24c58ebfc9
|
@ -2059,15 +2059,12 @@ def make_in_list_sql_clause(
|
||||||
KV = TypeVar("KV")
|
KV = TypeVar("KV")
|
||||||
|
|
||||||
|
|
||||||
def make_tuple_comparison_clause(
|
def make_tuple_comparison_clause(keys: List[Tuple[str, KV]]) -> Tuple[str, List[KV]]:
|
||||||
_database_engine: BaseDatabaseEngine, keys: List[Tuple[str, KV]]
|
|
||||||
) -> Tuple[str, List[KV]]:
|
|
||||||
"""Returns a tuple comparison SQL clause
|
"""Returns a tuple comparison SQL clause
|
||||||
|
|
||||||
Builds a SQL clause that looks like "(a, b) > (?, ?)"
|
Builds a SQL clause that looks like "(a, b) > (?, ?)"
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
_database_engine
|
|
||||||
keys: A set of (column, value) pairs to be compared.
|
keys: A set of (column, value) pairs to be compared.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
|
@ -298,7 +298,6 @@ class ClientIpBackgroundUpdateStore(SQLBaseStore):
|
||||||
# times, which is fine.
|
# times, which is fine.
|
||||||
|
|
||||||
where_clause, where_args = make_tuple_comparison_clause(
|
where_clause, where_args = make_tuple_comparison_clause(
|
||||||
self.database_engine,
|
|
||||||
[("user_id", last_user_id), ("device_id", last_device_id)],
|
[("user_id", last_user_id), ("device_id", last_device_id)],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -985,7 +985,7 @@ class DeviceBackgroundUpdateStore(SQLBaseStore):
|
||||||
|
|
||||||
def _txn(txn):
|
def _txn(txn):
|
||||||
clause, args = make_tuple_comparison_clause(
|
clause, args = make_tuple_comparison_clause(
|
||||||
self.db_pool.engine, [(x, last_row[x]) for x in KEY_COLS]
|
[(x, last_row[x]) for x in KEY_COLS]
|
||||||
)
|
)
|
||||||
sql = """
|
sql = """
|
||||||
SELECT stream_id, destination, user_id, device_id, MAX(ts) AS ts
|
SELECT stream_id, destination, user_id, device_id, MAX(ts) AS ts
|
||||||
|
|
|
@ -838,7 +838,6 @@ class EventsBackgroundUpdatesStore(SQLBaseStore):
|
||||||
# We want to do a `(topological_ordering, stream_ordering) > (?,?)`
|
# We want to do a `(topological_ordering, stream_ordering) > (?,?)`
|
||||||
# comparison, but that is not supported on older SQLite versions
|
# comparison, but that is not supported on older SQLite versions
|
||||||
tuple_clause, tuple_args = make_tuple_comparison_clause(
|
tuple_clause, tuple_args = make_tuple_comparison_clause(
|
||||||
self.database_engine,
|
|
||||||
[
|
[
|
||||||
("events.room_id", last_room_id),
|
("events.room_id", last_room_id),
|
||||||
("topological_ordering", last_depth),
|
("topological_ordering", last_depth),
|
||||||
|
|
|
@ -36,7 +36,6 @@ def _stub_db_engine(**kwargs) -> BaseDatabaseEngine:
|
||||||
|
|
||||||
class TupleComparisonClauseTestCase(unittest.TestCase):
|
class TupleComparisonClauseTestCase(unittest.TestCase):
|
||||||
def test_native_tuple_comparison(self):
|
def test_native_tuple_comparison(self):
|
||||||
db_engine = _stub_db_engine()
|
clause, args = make_tuple_comparison_clause([("a", 1), ("b", 2)])
|
||||||
clause, args = make_tuple_comparison_clause(db_engine, [("a", 1), ("b", 2)])
|
|
||||||
self.assertEqual(clause, "(a,b) > (?,?)")
|
self.assertEqual(clause, "(a,b) > (?,?)")
|
||||||
self.assertEqual(args, [1, 2])
|
self.assertEqual(args, [1, 2])
|
||||||
|
|
Loading…
Reference in New Issue