add columns if modifying tables

This commit is contained in:
Peinthor Rene
2013-03-24 13:02:27 +01:00
parent efef0cc5ac
commit c4f09765b3

View File

@@ -115,6 +115,16 @@ void EditTableDialog::accept()
} else {
// Editing of old table
// add added fields
// TODO this will not work if an added field is marked
// as autoincrement
QString sTablesql = pdb->getTableSQL(curTable);
sqlb::Table oldschema = sqlb::Table::parseSQL(sTablesql);
for( int i = oldschema.fields().count(); i < m_table.fields().count(); ++i)
{
pdb->addColumn(curTable, m_table.fields().at(i));
}
// Rename table if necessary
if(ui->editTableName->text() != curTable)
{