From 5fcca6ed0cff5cc4ad11c36375bdc99fa06fbd32 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 10 Sep 2019 15:03:17 -0400 Subject: [PATCH] feedback -add comment for the fetchall() that if removed will cause SQLITE_MISUSE --- torba/torba/client/basedatabase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/torba/torba/client/basedatabase.py b/torba/torba/client/basedatabase.py index e45df66db..42b3c0a55 100644 --- a/torba/torba/client/basedatabase.py +++ b/torba/torba/client/basedatabase.py @@ -40,6 +40,7 @@ class AIOSQLite: def executemany(self, sql: str, params: Iterable): params = params if params is not None else [] + # this fetchall is needed to prevent SQLITE_MISUSE return self.run(lambda conn: conn.executemany(sql, params).fetchall()) def executescript(self, script: str) -> Awaitable: @@ -584,7 +585,7 @@ class BaseDatabase(SQLiteMixin): async def add_keys(self, account, chain, keys): await self.db.executemany( - "insert into pubkey_address values (?, ?, ?, ?, ?, NULL, 0)", + "insert into pubkey_address (address, account, chain, position, pubkey) values (?, ?, ?, ?, ?)", ( (pubkey.address, account.public_key.address, chain, position, sqlite3.Binary(pubkey.pubkey_bytes))