# HG changeset patch # User casties # Date 1330028234 -3600 # Node ID 60fea3a6c695aa9aef72d18ffff834b902f441fd # Parent 48ed91b2978435fc2812316592a3663b34bea79d better fix for psycopg 2.4. better quoting of sql arguments. diff -r 48ed91b29784 -r 60fea3a6c695 DBInterface.py --- a/DBInterface.py Thu Feb 23 08:33:48 2012 +0100 +++ b/DBInterface.py Thu Feb 23 21:17:14 2012 +0100 @@ -171,11 +171,15 @@ cur.execute(query, args) # description of returned fields fields = cur.description - logging.debug("fields: %s"%repr(fields)) + #logging.debug("fields: %s"%repr(fields)) if len(fields) > 0: # re-pack Column object in tuple - fields = (f[0:] for f in fields) - logging.debug("re-packed fields: %s"%repr(fields)) + fs = [] + for f in fields: + fs.append(f[0:]) + + fields = fs + #logging.debug("re-packed fields: %s"%repr(fields)) if hasResult: # get all data in an array diff -r 48ed91b29784 -r 60fea3a6c695 RestDbInterface.py --- a/RestDbInterface.py Thu Feb 23 08:33:48 2012 +0100 +++ b/RestDbInterface.py Thu Feb 23 21:17:14 2012 +0100 @@ -181,9 +181,9 @@ """return table data""" logging.debug("gettable") if sortBy: - data = self.executeSQL('select * from "%s"."%s" order by %s'%(schema,table,sortBy)) + data = self.executeSQL('select * from "%s"."%s" order by %%s'%(sqlName(schema),sqlName(table)),(sortBy,)) else: - data = self.executeSQL('select * from "%s"."%s"'%(schema,table)) + data = self.executeSQL('select * from "%s"."%s"'%(sqlName(schema),sqlName(table))) return data def hasTable(self,schema='public',table=None,username='guest'):