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

This commit is contained in:
Benjamin Renard 2021-07-12 12:18:38 +02:00
parent 6e778a8691
commit 21bd45ad25

View file

@ -84,11 +84,11 @@ class PgDB:
self.con.rollback() self.con.rollback()
return False return False
def doSelect(self, sql): def doSelect(self, sql, params):
""" Run SELECT SQL query and return result as dict """ """ Run SELECT SQL query and return result as dict """
cursor = self.con.cursor() cursor = self.con.cursor()
try: try:
cursor.execute(sql) cursor.execute(sql, params)
results = cursor.fetchall() results = cursor.fetchall()
return results return results
except Exception: except Exception: