Fix travis

This commit is contained in:
Ailurupoda 2019-02-07 16:44:28 +01:00
parent e9e9fd322e
commit f27ecab62f
5 changed files with 21 additions and 44 deletions

View File

@ -620,17 +620,11 @@ class GPKGDBConnector(DBConnector):
""" run vacuum on the db """
self._execute_and_commit("VACUUM")
def commentTable(self, schema, tablename, comment):
def commentTable(self, schema, tablename, comment=None, db):
"""Comment the table"""
return ''
def commentTable(self, schema, tablename, comment):
return ''
def unCommentTable(self, schema, tablename):
return ''
def getComment(self, tab, field, db):
def getComment(self, tablename, field, db):
"""Returns the comment for a field"""
return ''

View File

@ -1307,17 +1307,11 @@ class OracleDBConnector(DBConnector):
# Unsupported in Oracle
pass
def commentTable(self, schema, tablename, comment):
def commentTable(self, schema, tablename, comment=None, db):
"""Comment the table"""
return ''
def commentTable(self, schema, tablename, comment):
return ''
def unCommentTable(self, schema, tablename):
return ''
def getComment(self, tab, field, db):
def getComment(self, tablename, field, db):
"""Returns the comment for a field"""
return ''

View File

@ -742,18 +742,19 @@ class PostGisDBConnector(DBConnector):
self._commit()
def commentTable(self, schema, tablename, comment, db):
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}\';'.format(schema, tablename, comment))
def commentTable(self, schema, tablename, comment=None, db):
if comment = None:
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS NULL;'.format(schema, tablename))
else:
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}\';'.format(schema, tablename, comment))
def unCommentTable(self, schema, tablename, db):
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS NULL;'.format(schema, tablename))
def getComment(self, tab, field, db):
def getComment(self, tablename, field, db):
"""Returns the comment for a field"""
# SQL Query checking if a comment exists for the field
sql_cpt = "Select count(*) from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tab, field)
sql_cpt = "Select count(*) from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tablename, field)
# SQL Query that return the comment of the field
sql = "Select pd.description from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tab, field)
sql = "Select pd.description from pg_description pd, pg_class pc, pg_attribute pa where relname = '%s' and attname = '%s' and pa.attrelid = pc.oid and pd.objoid = pc.oid and pd.objsubid = pa.attnum" % (tablename, field)
c = db.connector._execute(None, sql_cpt) # Execute Check query
res = db.connector._fetchone(c)[0] # Store result
if res == 1:

View File

@ -571,17 +571,11 @@ class SpatiaLiteDBConnector(DBConnector):
c.execute('VACUUM')
self.connection.isolation_level = '' # reset to default isolation
def commentTable(self, schema, tablename, comment):
def commentTable(self, schema, tablename, comment=None, db):
"""Comment the table"""
return ''
def commentTable(self, schema, tablename, comment):
return ''
def unCommentTable(self, schema, tablename):
return ''
def getComment(self, tab, field, db):
def getComment(self, tablename, field, db):
"""Returns the comment for a field"""
return ''
@ -591,13 +585,13 @@ class SpatiaLiteDBConnector(DBConnector):
self._execute_and_commit(sql)
self._execute(None, sql)
# sql = u"SELECT InvalidateLayerStatistics(%s)" % (self.quoteId(table))
# self._execute(None, sql)
sql = u"SELECT InvalidateLayerStatistics(%s)" % (self.quoteId(table))
self._execute(None, sql)
# sql = u"SELECT UpdateLayerStatistics(%s)" % (self.quoteId(table))
# self._execute(None, sql)
sql = u"SELECT UpdateLayerStatistics(%s)" % (self.quoteId(table))
self._execute(None, sql)
# self._commit()
self._commit()
return True
def deleteTableColumn(self, table, column):

View File

@ -342,17 +342,11 @@ class VLayerConnector(DBConnector):
print("**unimplemented** runVacuum")
return False
def commentTable(self, schema, tablename, comment):
def commentTable(self, schema, tablename, comment=None, db):
"""Comment the table"""
return ''
def commentTable(self, schema, tablename, comment):
return ''
def unCommentTable(self, schema, tablename):
return ''
def getComment(self, tab, field, db):
def getComment(self, tablename, field, db):
"""Returns the comment for a field"""
return ''