params added to getMany
This commit is contained in:
parent
878ff31a52
commit
b0daebe699
@ -19,7 +19,7 @@ SELECT m.id as id,
|
||||
FROM wohnung w, objekt o, mieter m
|
||||
WHERE o.id = w.objekt AND
|
||||
w.id = m.wohnung
|
||||
""")
|
||||
""", [], "Mieter")
|
||||
|
||||
def get_mieter(id=None):
|
||||
return getOne("""
|
||||
|
@ -1,7 +1,7 @@
|
||||
from dbpool import getConnection, getMany, getOne
|
||||
|
||||
def get_objekte():
|
||||
return getMany("SELECT id, shortname, flaeche FROM objekt")
|
||||
return getMany("SELECT id, shortname, flaeche FROM objekt", [], "Objekt")
|
||||
|
||||
def get_objekt(id=None):
|
||||
return getOne("SELECT id, shortname, flaeche FROM objekt WHERE id = ?",
|
||||
|
@ -9,7 +9,7 @@ SELECT w.id as id,
|
||||
o.shortname as objekt
|
||||
FROM wohnung w, objekt o
|
||||
WHERE o.id = w.objekt
|
||||
""")
|
||||
""", [], "Wohnung")
|
||||
|
||||
def get_wohnung(id=None):
|
||||
return getOne("""
|
||||
|
@ -28,12 +28,12 @@ def getConnection():
|
||||
return pool.get_connection()
|
||||
|
||||
|
||||
def getMany(stmt):
|
||||
def getMany(stmt, params, objName):
|
||||
try:
|
||||
dbh = getConnection()
|
||||
objs = []
|
||||
cur = dbh.cursor(dictionary=True)
|
||||
cur.execute(stmt)
|
||||
cur.execute(stmt, params)
|
||||
for obj in cur:
|
||||
objs.append(obj)
|
||||
return objs
|
||||
|
Loading…
x
Reference in New Issue
Block a user