Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix using virtual layers in DB manager
getTableFields and getTableRowCount receive the table name and not the table. 
I did not change the argument name (although it would be good) to keep it in line with all the other methods

see:
https://github.com/qgis/QGIS/blob/master/python/plugins/db_manager/db_plugins/plugin.py#L742
https://github.com/qgis/QGIS/blob/master/python/plugins/db_manager/db_plugins/plugin.py#L879
  • Loading branch information
mbernasocchi committed Sep 10, 2018
1 parent 4b7da69 commit 4e30eb4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions python/plugins/db_manager/db_plugins/vlayers/connector.py
Expand Up @@ -250,16 +250,14 @@ def getRasterTables(self, schema=None):
return []

def getTableRowCount(self, table):
t = table[1]
l = VLayerRegistry.instance().getLayer(t)
l = VLayerRegistry.instance().getLayer(table)
if not l or not l.isValid():
return None
return l.featureCount()

def getTableFields(self, table):
""" return list of columns in table """
t = table[1]
l = VLayerRegistry.instance().getLayer(t)
l = VLayerRegistry.instance().getLayer(table)
if not l or not l.isValid():
return []
# id, name, type, nonnull, default, pk
Expand Down

0 comments on commit 4e30eb4

Please sign in to comment.