DBAPI: PostgreSQL crash (#421)

Fixes #0010071.
This commit is contained in:
Josip 2017-06-16 16:53:36 +02:00 committed by GitHub
parent 1a4d43dbbf
commit bec8cea3e3

View File

@ -65,6 +65,7 @@ class Postgresql:
query = query.replace("?", "%s") query = query.replace("?", "%s")
query = query.replace("REGEXP", "~") query = query.replace("REGEXP", "~")
query = query.replace("desc", "desc_") query = query.replace("desc", "desc_")
query = query.replace("BLOB", "bytea")
## LIMIT offset, count ## LIMIT offset, count
## count can be -1, for all ## count can be -1, for all
## LIMIT -1 ## LIMIT -1
@ -114,7 +115,7 @@ class Postgresql:
def table_exists(self, table): def table_exists(self, table):
self.__cursor.execute("SELECT COUNT(*) " self.__cursor.execute("SELECT COUNT(*) "
"FROM information_schema.tables " "FROM information_schema.tables "
"WHERE table_name=?;", [table]) "WHERE table_name=%s;", [table])
return self.fetchone()[0] != 0 return self.fetchone()[0] != 0
def close(self): def close(self):