PgDB: add possibility to provide query parameters on doSelect()

This commit is contained in:
Benjamin Renard 2021-07-12 12:16:42 +02:00
parent 198d6021b4
commit 8dbb067996

View file

@ -70,10 +70,13 @@ class PgDB(object):
self.con.rollback() self.con.rollback()
return False return False
def doSelect(self,sql): def doSelect(self,sql,params):
cursor = self.con.cursor() cursor = self.con.cursor()
try: try:
if params is None:
cursor.execute(sql) cursor.execute(sql)
else:
cursor.execute(sql,params)
results = cursor.fetchall() results = cursor.fetchall()
return results return results
except Exception: except Exception: