Update worms to match sqlhelpers.
This commit is contained in:
parent
54fa46c4f9
commit
1fe6de793c
1 changed files with 3 additions and 4 deletions
|
@ -421,13 +421,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) -> sqlite3.Cursor:
|
def insert(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)
|
||||||
column_names = self.COLUMNS[table]
|
(qmarks, bindings) = sqlhelpers.insert_filler(pairs)
|
||||||
(qmarks, bindings) = sqlhelpers.insert_filler(column_names, data)
|
query = f'INSERT INTO {table} {qmarks}'
|
||||||
query = f'INSERT INTO {table} VALUES({qmarks})'
|
|
||||||
return self.execute(query, bindings)
|
return self.execute(query, bindings)
|
||||||
|
|
||||||
def normalize_object_id(self, object_class, object_id):
|
def normalize_object_id(self, object_class, object_id):
|
||||||
|
|
Loading…
Reference in a new issue