Skip to content

Commit

Permalink
Support SQL auto-completion for tables from different schemata
Browse files Browse the repository at this point in the history
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 1a3e3d3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1a3e3d3

Please sign in to comment.