Prune down Database.column_placeholders() a bit
This commit is contained in:
parent
e577cb2759
commit
28fd4050c7
1 changed files with 1 additions and 17 deletions
|
@ -108,23 +108,7 @@ class Database():
|
||||||
return Database(db)
|
return Database(db)
|
||||||
|
|
||||||
def column_placeholders(self, table, obj) -> list:
|
def column_placeholders(self, table, obj) -> list:
|
||||||
ctors = getattr(table, '__constructors__')
|
return ['?' for c in table.__columns__ if c != table.__key__]
|
||||||
|
|
||||||
if ctors is None:
|
|
||||||
return ['?' for c in table.__columns__ if c != table.__key__]
|
|
||||||
if ctors is not None:
|
|
||||||
ret = list()
|
|
||||||
|
|
||||||
for c in table.__columns__:
|
|
||||||
if c == table.__key__:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if c in ctors:
|
|
||||||
ret.append(ctors[c](getattr(obj, c)))
|
|
||||||
else:
|
|
||||||
ret.append('?')
|
|
||||||
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def add(self, obj):
|
def add(self, obj):
|
||||||
fn = getattr(obj, '__insert__')
|
fn = getattr(obj, '__insert__')
|
||||||
|
|
Loading…
Add table
Reference in a new issue