New column page
Shows SQL for columns ALTER TABLE ... [ADD|DROP] COLUMN combines a selection of multiple columns into a single alter table. Show collation in list of columns. (order of columns isn't what is should be but that should maybe be fixed by a generic column selection and ordering mechanism that knows what the default sort should be)
This commit is contained in:
parent
73c4cf4790
commit
57217974f4
19 changed files with 345 additions and 55 deletions
|
|
@ -4,6 +4,8 @@
|
|||
#include "PgAttributeContainer.h"
|
||||
#include "PgClassContainer.h"
|
||||
#include "PgConstraintContainer.h"
|
||||
#include "PgCollation.h"
|
||||
#include "PgCollationContainer.h"
|
||||
#include "PgType.h"
|
||||
#include "PgTypeContainer.h"
|
||||
#include "PgIndexContainer.h"
|
||||
|
|
@ -197,31 +199,34 @@ QVariant ColumnTableModel::getData(const QModelIndex &index) const
|
|||
}
|
||||
}
|
||||
else {
|
||||
QString s;
|
||||
switch (col) {
|
||||
case AttnumCol:
|
||||
s = QString::asprintf("%d", (int) t.num);
|
||||
break;
|
||||
//s = QString::asprintf("%d", (int) t.num);
|
||||
//break;
|
||||
return static_cast<int>(t.num);
|
||||
case NameCol:
|
||||
s = t.name;
|
||||
v = t.name;
|
||||
break;
|
||||
case TypeCol:
|
||||
s = getTypeDisplayString(*m_catalog, t.typid, t.typmod);
|
||||
v = getTypeDisplayString(*m_catalog, t.typid, t.typmod);
|
||||
break;
|
||||
case NullCol:
|
||||
s = QString::fromStdU16String(t.notnull ? u"" : u"N");
|
||||
v = QString::fromStdU16String(t.notnull ? u"" : u"N");
|
||||
break;
|
||||
case DefaultCol:
|
||||
s = t.defaultValue;
|
||||
v = t.defaultValue;
|
||||
break;
|
||||
case ForeignKeyCol:
|
||||
s = getFKey(t);
|
||||
v = getFKey(t);
|
||||
break;
|
||||
case CollationCol:
|
||||
s = ""; //t.collation;
|
||||
if (t.collation != InvalidOid) {
|
||||
auto&& col = m_catalog->collations()->getByKey(t.collation);
|
||||
if (col)
|
||||
v = col->objectName();
|
||||
}
|
||||
break;
|
||||
}
|
||||
v = s;
|
||||
}
|
||||
|
||||
return v;
|
||||
|
|
@ -290,3 +295,8 @@ QVariant ColumnTableModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
return BaseTableModel::data(index, role);
|
||||
}
|
||||
|
||||
const PgAttribute& ColumnTableModel::column(int row) const
|
||||
{
|
||||
return m_columns.at(static_cast<size_t>(row));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue