mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-01 01:19:15 -05:00
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:
@@ -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
|
||||
|
||||
@@ -288,6 +288,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelEditWarning">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600; color:#ff0000;">Warning: </span>There is something with this table definition that our parser doesn't fully understand. Modifying and saving this table might result it in problems.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user