Better error reporting of problems during catalog load.
This commit is contained in:
parent
2a29bed75e
commit
c37e9eccb8
2 changed files with 24 additions and 15 deletions
|
|
@ -55,20 +55,26 @@ QueryTab *MainWindow::GetActiveQueryTab()
|
||||||
void MainWindow::setConfig(const ConnectionConfig &config)
|
void MainWindow::setConfig(const ConnectionConfig &config)
|
||||||
{
|
{
|
||||||
m_config = config;
|
m_config = config;
|
||||||
auto res = OpenDatabase::createOpenDatabase(config);
|
try {
|
||||||
if (res.valid()) {
|
auto res = OpenDatabase::createOpenDatabase(config);
|
||||||
m_database = res.get();
|
if (res.valid()) {
|
||||||
|
m_database = res.get();
|
||||||
|
}
|
||||||
|
QString title = "pglab - ";
|
||||||
|
title += m_config.name().c_str();
|
||||||
|
setWindowTitle(title);
|
||||||
|
|
||||||
|
auto tt = new TablesPage(this);
|
||||||
|
tt->setCatalog(m_database->catalogue());
|
||||||
|
ui->tabWidget->addTab(tt, "Tables");
|
||||||
|
ui->tabWidget->setCurrentWidget(tt);
|
||||||
|
|
||||||
|
newSqlPage();
|
||||||
|
} catch (std::runtime_error &ex) {
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(QString::fromUtf8(ex.what()));
|
||||||
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
QString title = "pglab - ";
|
|
||||||
title += m_config.name().c_str();
|
|
||||||
setWindowTitle(title);
|
|
||||||
|
|
||||||
auto tt = new TablesPage(this);
|
|
||||||
tt->setCatalog(m_database->catalogue());
|
|
||||||
ui->tabWidget->addTab(tt, "Tables");
|
|
||||||
ui->tabWidget->setCurrentWidget(tt);
|
|
||||||
|
|
||||||
newSqlPage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionLoad_SQL_triggered()
|
void MainWindow::on_actionLoad_SQL_triggered()
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,11 @@ void load(Pgsql::Connection &conn, IPgContainter &pg_cont)
|
||||||
Pgsql::Result result = conn.query(q.c_str());
|
Pgsql::Result result = conn.query(q.c_str());
|
||||||
if (result && result.resultStatus() == PGRES_TUPLES_OK)
|
if (result && result.resultStatus() == PGRES_TUPLES_OK)
|
||||||
pg_cont.load(result);
|
pg_cont.load(result);
|
||||||
else
|
else {
|
||||||
throw std::runtime_error("Query failed");
|
auto details = result.diagDetails();
|
||||||
|
|
||||||
|
throw std::runtime_error("Query failed\n" + details.errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue