Add type annotation sqlite3.Cursor.
This commit is contained in:
parent
6da730e5a6
commit
a76982e581
1 changed files with 3 additions and 4 deletions
|
@ -163,7 +163,7 @@ class Database(metaclass=abc.ABCMeta):
|
||||||
self.sql.commit()
|
self.sql.commit()
|
||||||
self.last_commit_id = RNG.getrandbits(32)
|
self.last_commit_id = RNG.getrandbits(32)
|
||||||
|
|
||||||
def delete(self, table, pairs) -> None:
|
def delete(self, table, pairs) -> sqlite3.Cursor:
|
||||||
if isinstance(table, type) and issubclass(table, Object):
|
if isinstance(table, type) and issubclass(table, Object):
|
||||||
table = table.table
|
table = table.table
|
||||||
self.assert_table_exists(table)
|
self.assert_table_exists(table)
|
||||||
|
@ -276,13 +276,12 @@ class Database(metaclass=abc.ABCMeta):
|
||||||
tables = set(self.select_column(query))
|
tables = set(self.select_column(query))
|
||||||
return tables
|
return tables
|
||||||
|
|
||||||
def insert(self, table, data) -> None:
|
def insert(self, table, data) -> sqlite3.Cursor:
|
||||||
if isinstance(table, type) and issubclass(table, Object):
|
if isinstance(table, type) and issubclass(table, Object):
|
||||||
table = table.table
|
table = table.table
|
||||||
self.assert_table_exists(table)
|
self.assert_table_exists(table)
|
||||||
column_names = self.COLUMNS[table]
|
column_names = self.COLUMNS[table]
|
||||||
(qmarks, bindings) = sqlhelpers.insert_filler(column_names, data)
|
(qmarks, bindings) = sqlhelpers.insert_filler(column_names, data)
|
||||||
|
|
||||||
query = f'INSERT INTO {table} VALUES({qmarks})'
|
query = f'INSERT INTO {table} VALUES({qmarks})'
|
||||||
return self.execute(query, bindings)
|
return self.execute(query, bindings)
|
||||||
|
|
||||||
|
@ -434,7 +433,7 @@ class Database(metaclass=abc.ABCMeta):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def update(self, table, pairs, where_key) -> None:
|
def update(self, table, pairs, where_key) -> sqlite3.Cursor:
|
||||||
if isinstance(table, type) and issubclass(table, Object):
|
if isinstance(table, type) and issubclass(table, Object):
|
||||||
table = table.table
|
table = table.table
|
||||||
self.assert_table_exists(table)
|
self.assert_table_exists(table)
|
||||||
|
|
Loading…
Reference in a new issue