PgDB: add possibility to provide query parameters on doSelect()
This commit is contained in:
parent
198d6021b4
commit
8dbb067996
1 changed files with 12 additions and 9 deletions
5
PgDB.py
5
PgDB.py
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue