Skip to content

Commit f27ecab

Browse files
committedFeb 7, 2019
Fix travis
1 parent e9e9fd3 commit f27ecab

File tree

5 files changed

+21
-44
lines changed

5 files changed

+21
-44
lines changed
 

‎python/plugins/db_manager/db_plugins/gpkg/connector.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -620,17 +620,11 @@ def runVacuum(self):
620620
""" run vacuum on the db """
621621
self._execute_and_commit("VACUUM")
622622

623-
def commentTable(self, schema, tablename, comment):
623+
def commentTable(self, schema, tablename, comment=None, db):
624624
"""Comment the table"""
625625
return ''
626626

627-
def commentTable(self, schema, tablename, comment):
628-
return ''
629-
630-
def unCommentTable(self, schema, tablename):
631-
return ''
632-
633-
def getComment(self, tab, field, db):
627+
def getComment(self, tablename, field, db):
634628
"""Returns the comment for a field"""
635629
return ''
636630

‎python/plugins/db_manager/db_plugins/oracle/connector.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,17 +1307,11 @@ def renameSchema(self, schema, new_schema):
13071307
# Unsupported in Oracle
13081308
pass
13091309

1310-
def commentTable(self, schema, tablename, comment):
1310+
def commentTable(self, schema, tablename, comment=None, db):
13111311
"""Comment the table"""
13121312
return ''
13131313

1314-
def commentTable(self, schema, tablename, comment):
1315-
return ''
1316-
1317-
def unCommentTable(self, schema, tablename):
1318-
return ''
1319-
1320-
def getComment(self, tab, field, db):
1314+
def getComment(self, tablename, field, db):
13211315
"""Returns the comment for a field"""
13221316
return ''
13231317

‎python/plugins/db_manager/db_plugins/postgis/connector.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -742,18 +742,19 @@ def renameTable(self, table, new_table):
742742

743743
self._commit()
744744

745-
def commentTable(self, schema, tablename, comment, db):
746-
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}\';'.format(schema, tablename, comment))
745+
def commentTable(self, schema, tablename, comment=None, db):
746+
if comment = None:
747+
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS NULL;'.format(schema, tablename))
748+
else:
749+
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}\';'.format(schema, tablename, comment))
747750

748-
def unCommentTable(self, schema, tablename, db):
749-
db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS NULL;'.format(schema, tablename))
750751

751-
def getComment(self, tab, field, db):
752+
def getComment(self, tablename, field, db):
752753
"""Returns the comment for a field"""
753754
# SQL Query checking if a comment exists for the field
754-
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)
755+
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)
755756
# SQL Query that return the comment of the field
756-
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)
757+
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)
757758
c = db.connector._execute(None, sql_cpt) # Execute Check query
758759
res = db.connector._fetchone(c)[0] # Store result
759760
if res == 1:

‎python/plugins/db_manager/db_plugins/spatialite/connector.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -571,17 +571,11 @@ def runVacuum(self):
571571
c.execute('VACUUM')
572572
self.connection.isolation_level = '' # reset to default isolation
573573

574-
def commentTable(self, schema, tablename, comment):
574+
def commentTable(self, schema, tablename, comment=None, db):
575575
"""Comment the table"""
576576
return ''
577577

578-
def commentTable(self, schema, tablename, comment):
579-
return ''
580-
581-
def unCommentTable(self, schema, tablename):
582-
return ''
583-
584-
def getComment(self, tab, field, db):
578+
def getComment(self, tablename, field, db):
585579
"""Returns the comment for a field"""
586580
return ''
587581

@@ -591,13 +585,13 @@ def addTableColumn(self, table, field_def):
591585
self._execute_and_commit(sql)
592586
self._execute(None, sql)
593587

594-
# sql = u"SELECT InvalidateLayerStatistics(%s)" % (self.quoteId(table))
595-
# self._execute(None, sql)
588+
sql = u"SELECT InvalidateLayerStatistics(%s)" % (self.quoteId(table))
589+
self._execute(None, sql)
596590

597-
# sql = u"SELECT UpdateLayerStatistics(%s)" % (self.quoteId(table))
598-
# self._execute(None, sql)
591+
sql = u"SELECT UpdateLayerStatistics(%s)" % (self.quoteId(table))
592+
self._execute(None, sql)
599593

600-
# self._commit()
594+
self._commit()
601595
return True
602596

603597
def deleteTableColumn(self, table, column):

‎python/plugins/db_manager/db_plugins/vlayers/connector.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,17 +342,11 @@ def runVacuum(self):
342342
print("**unimplemented** runVacuum")
343343
return False
344344

345-
def commentTable(self, schema, tablename, comment):
345+
def commentTable(self, schema, tablename, comment=None, db):
346346
"""Comment the table"""
347347
return ''
348348

349-
def commentTable(self, schema, tablename, comment):
350-
return ''
351-
352-
def unCommentTable(self, schema, tablename):
353-
return ''
354-
355-
def getComment(self, tab, field, db):
349+
def getComment(self, tablename, field, db):
356350
"""Returns the comment for a field"""
357351
return ''
358352

0 commit comments

Comments
 (0)
Please sign in to comment.