Skip to content
Permalink
Browse files

Fix travis

  • Loading branch information
Ailurupoda committed Feb 7, 2019
1 parent e9e9fd3 commit f27ecab62f7c6a7a64d922a32e9d20ef4d07ac66
@@ -620,17 +620,11 @@ def runVacuum(self):
""" 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 ''

@@ -1307,17 +1307,11 @@ def renameSchema(self, schema, new_schema):
# 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 ''

@@ -742,18 +742,19 @@ def renameTable(self, table, new_table):

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:
@@ -571,17 +571,11 @@ def runVacuum(self):
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 @@ def addTableColumn(self, table, field_def):
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):
@@ -342,17 +342,11 @@ def runVacuum(self):
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 ''

0 comments on commit f27ecab

Please sign in to comment.
You can’t perform that action at this time.