Skip to content

Commit

Permalink
[db_manager] Fix DBConnector.getSchemaTableName
Browse files Browse the repository at this point in the history
Fix #15910
  • Loading branch information
arnaud-morvan committed Apr 28, 2017
1 parent 09d1263 commit cfe8dfe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/plugins/db_manager/db_plugins/connector.py
Expand Up @@ -213,7 +213,9 @@ def quoteString(self, txt):
def getSchemaTableName(self, table):
if not hasattr(table, '__iter__') and not isinstance(table, str):
return (None, table)
elif len(table) < 2:
if isinstance(table, str):
table = table.split('.')
if len(table) < 2:
return (None, table[0])
else:
return (table[0], table[1])
Expand Down

3 comments on commit cfe8dfe

@strk
Copy link
Contributor

@strk strk commented on cfe8dfe Jun 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first conditional seems wrong (not hasattrs and not isinstance...) because a str instance would not have __iter__ attribute, so the check is superflous, right ?

@arnaud-morvan
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a test for the case table parameter is "schemaname.tablename", this have caused db_manage to be unusable for a long time.

@arnaud-morvan
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, Missunderstood your comment, the first test seems to be for the case table parameter is not an instance of str (something else, like a TableDataModel or TableItem). Having a more explicit test would be better here.

Please sign in to comment.