-add comment for the fetchall() that if removed will cause SQLITE_MISUSE
This commit is contained in:
Jack Robison 2019-09-10 15:03:17 -04:00
parent a05c44ad1e
commit 5fcca6ed0c
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -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))