DBBrowserDB: Merge renameColumn() and dropColumn()

Merge the renameColumn() and dropColumn() methods. They are just way too
long and complicated but also very similar that it makes no sense to
keep them separated.
This also simplifies the code of renameColumn() a bit while fixing the
trigger/view/index problem in dropColumn().
This commit is contained in:
Martin Kleusberg
2013-06-04 17:36:14 +02:00
parent 2463116976
commit 324bb23193
4 changed files with 48 additions and 114 deletions

View File

@@ -361,7 +361,7 @@ void EditTableDialog::removeField()
QString msg = tr("Are you sure you want to delete the field '%1'?\nAll data currently stored in this field will be lost.").arg(ui->treeWidget->currentItem()->text(0));
if(QMessageBox::warning(this, QApplication::applicationName(), msg, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape) == QMessageBox::Yes)
{
if(!pdb->dropColumn(curTable, ui->treeWidget->currentItem()->text(0)))
if(!pdb->renameColumn(curTable, ui->treeWidget->currentItem()->text(0), sqlb::FieldPtr()))
{
QMessageBox::warning(0, QApplication::applicationName(), pdb->lastErrorMessage);
} else {