Completion of qualified table names

This adds the schema names to the possible completions and adds support
for cascading completion of schema.table.field.

See related issue #1433
This commit is contained in:
mgrojo
2018-09-05 23:03:47 +02:00
parent 60195c78ed
commit d0b5ff10a7
4 changed files with 26 additions and 13 deletions

View File

@@ -475,9 +475,10 @@ void MainWindow::populateStructure(const QString& old_table)
return;
// Update table and column names for syntax highlighting
SqlUiLexer::TablesAndColumnsMap tablesToColumnsMap;
SqlUiLexer::QualifiedTablesMap qualifiedTablesMap;
for(auto it=db.schemata.constBegin();it!=db.schemata.constEnd();++it)
{
SqlUiLexer::TablesAndColumnsMap tablesToColumnsMap;
objectMap tab = db.getBrowsableObjects(it.key());
for(auto it : tab)
{
@@ -487,8 +488,9 @@ void MainWindow::populateStructure(const QString& old_table)
for(const sqlb::FieldInfo& f : fi)
tablesToColumnsMap[objectname].append(f.name);
}
qualifiedTablesMap[it.key()] = tablesToColumnsMap;
}
SqlTextEdit::sqlLexer->setTableNames(tablesToColumnsMap);
SqlTextEdit::sqlLexer->setTableNames(qualifiedTablesMap);
ui->editLogApplication->reloadKeywords();
ui->editLogUser->reloadKeywords();
for(int i=0;i<ui->tabSqlAreas->count();i++)