Move DB pool and helper functions into dedicated Database class

This commit is contained in:
Erik Johnston 2019-12-04 13:52:46 +00:00
parent ddbbfc9512
commit 756d4942f5
62 changed files with 2377 additions and 2295 deletions

View file

@ -323,7 +323,7 @@ class UpsertManyTests(unittest.HomeserverTestCase):
self.table_name = "table_" + hs.get_secrets().token_hex(6)
self.get_success(
self.storage.runInteraction(
self.storage.db.runInteraction(
"create",
lambda x, *a: x.execute(*a),
"CREATE TABLE %s (id INTEGER, username TEXT, value TEXT)"
@ -331,7 +331,7 @@ class UpsertManyTests(unittest.HomeserverTestCase):
)
)
self.get_success(
self.storage.runInteraction(
self.storage.db.runInteraction(
"index",
lambda x, *a: x.execute(*a),
"CREATE UNIQUE INDEX %sindex ON %s(id, username)"
@ -354,9 +354,9 @@ class UpsertManyTests(unittest.HomeserverTestCase):
value_values = [["hello"], ["there"]]
self.get_success(
self.storage.runInteraction(
self.storage.db.runInteraction(
"test",
self.storage.simple_upsert_many_txn,
self.storage.db.simple_upsert_many_txn,
self.table_name,
key_names,
key_values,
@ -367,7 +367,7 @@ class UpsertManyTests(unittest.HomeserverTestCase):
# Check results are what we expect
res = self.get_success(
self.storage.simple_select_list(
self.storage.db.simple_select_list(
self.table_name, None, ["id, username, value"]
)
)
@ -381,9 +381,9 @@ class UpsertManyTests(unittest.HomeserverTestCase):
value_values = [["bleb"]]
self.get_success(
self.storage.runInteraction(
self.storage.db.runInteraction(
"test",
self.storage.simple_upsert_many_txn,
self.storage.db.simple_upsert_many_txn,
self.table_name,
key_names,
key_values,
@ -394,7 +394,7 @@ class UpsertManyTests(unittest.HomeserverTestCase):
# Check results are what we expect
res = self.get_success(
self.storage.simple_select_list(
self.storage.db.simple_select_list(
self.table_name, None, ["id, username, value"]
)
)