Show warning in Edit Table dialog when the grammar parser had trouble

The grammar parser returns a bool value to indicate if it encountered
some SQL feature that it doesn't understand yet. We might as well use
that bit of information and show it to the user.
This commit is contained in:
Martin Kleusberg
2016-08-20 17:37:59 +02:00
parent fe36ac0675
commit 64e07ad99e
2 changed files with 15 additions and 1 deletions
+5 -1
View File
@@ -29,9 +29,13 @@ EditTableDialog::EditTableDialog(DBBrowserDB* db, const QString& tableName, bool
{
// Existing table, so load and set the current layout
QString sTablesql = pdb->getObjectByName(curTable).getsql();
m_table = sqlb::Table::parseSQL(sTablesql).first;
QPair<sqlb::Table, bool> parse_result = sqlb::Table::parseSQL(sTablesql);
m_table = parse_result.first;
ui->labelEditWarning->setVisible(!parse_result.second);
ui->checkWithoutRowid->setChecked(m_table.isWithoutRowidTable());
populateFields();
} else {
ui->labelEditWarning->setVisible(false);
}
// And create a savepoint
+10
View File
@@ -288,6 +288,16 @@
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="labelEditWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;Warning: &lt;/span&gt;There is something with this table definition that our parser doesn't fully understand. Modifying and saving this table might result it in problems.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">