Permalink
Browse files

Support SQL auto-completion for tables from different schemata

This improves commit 44eb2d4 by adding
support for auto completion in the SQL editors for all tables that are
not in the "main" schema.
  • Loading branch information...
MKleusberg committed Sep 4, 2017
1 parent 315019d commit 1a3e3d3c40112d4dd92a6427eb84ad7fdbd4aa92
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/MainWindow.cpp
@@ -390,15 +390,18 @@ void MainWindow::populateStructure()
return;

// Update table and column names for syntax highlighting
objectMap tab = db.getBrowsableObjects("main");
SqlUiLexer::TablesAndColumnsMap tablesToColumnsMap;
for(auto it=tab.constBegin();it!=tab.constEnd();++it)
for(auto it=db.schemata.constBegin();it!=db.schemata.constEnd();++it)
{
QString objectname = (*it)->name();
objectMap tab = db.getBrowsableObjects(it.key());
for(auto it=tab.constBegin();it!=tab.constEnd();++it)
{
QString objectname = (*it)->name();

sqlb::FieldInfoList fi = (*it)->fieldInformation();
foreach(const sqlb::FieldInfo& f, fi)
tablesToColumnsMap[objectname].append(f.name);
sqlb::FieldInfoList fi = (*it)->fieldInformation();
foreach(const sqlb::FieldInfo& f, fi)
tablesToColumnsMap[objectname].append(f.name);
}
}
SqlTextEdit::sqlLexer->setTableNames(tablesToColumnsMap);
ui->editLogApplication->reloadKeywords();

0 comments on commit 1a3e3d3

Please sign in to comment.