Show in constraint list and in generated SQL when a constraint is inherited
This commit is contained in:
parent
60fb4ce285
commit
ccd88d0578
5 changed files with 50 additions and 22 deletions
|
|
@ -55,6 +55,9 @@ QVariant ConstraintModel::headerData(int section, Qt::Orientation orientation, i
|
|||
case SupportingIndexCol:
|
||||
c = tr("Supporting index");
|
||||
break;
|
||||
case InheritedCol:
|
||||
c = tr("Inherited");
|
||||
break;
|
||||
// case DefinitionCol:
|
||||
// c = tr("Definition");
|
||||
// break;
|
||||
|
|
@ -85,11 +88,17 @@ int ConstraintModel::columnCount(const QModelIndex &) const
|
|||
// return v;
|
||||
//}
|
||||
|
||||
Oid ConstraintModel::getType(int ) const
|
||||
Oid ConstraintModel::getType(int col) const
|
||||
{
|
||||
Oid oid = Pgsql::varchar_oid;
|
||||
|
||||
return oid;
|
||||
Oid oid;
|
||||
switch (col) {
|
||||
case InheritedCol:
|
||||
oid = Pgsql::bool_oid;
|
||||
break;
|
||||
default:
|
||||
oid = Pgsql::varchar_oid;
|
||||
}
|
||||
return oid;
|
||||
}
|
||||
|
||||
QString IconForConstraintType(ConstraintType ct)
|
||||
|
|
@ -128,25 +137,27 @@ QVariant ConstraintModel::getData(const QModelIndex &index) const
|
|||
const auto &t = m_constraints[row];
|
||||
|
||||
const int col = index.column();
|
||||
QString s;
|
||||
switch (col) {
|
||||
|
||||
switch (col) {
|
||||
case TypeCol:
|
||||
s = IconForConstraintType(t.type);
|
||||
v = IconForConstraintType(t.type);
|
||||
break;
|
||||
case NameCol:
|
||||
s = t.objectName();
|
||||
v = t.objectName();
|
||||
break;
|
||||
case NsCol:
|
||||
s = t.nsName();
|
||||
v = t.nsName();
|
||||
break;
|
||||
case SupportingIndexCol:
|
||||
s = getIndexDisplayString(*m_catalog, t.indid);
|
||||
v = getIndexDisplayString(*m_catalog, t.indid);
|
||||
break;
|
||||
case InheritedCol:
|
||||
v = t.isInherited();
|
||||
break;
|
||||
// case DefinitionCol:
|
||||
// s = t.definition;
|
||||
// break;
|
||||
}
|
||||
v = s;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue