Added list of constraints to the tables page.

Last column shows the full textual definition until I have decided on
a better way to visualize the details.
This commit is contained in:
eelke 2017-12-30 12:57:55 +01:00
parent 22db22c6b1
commit a99f059b70
27 changed files with 663 additions and 22 deletions

View file

@ -25,6 +25,64 @@ void operator<<(ConstraintType &s, const Pgsql::Value &v)
}
}
QString ShortNameForConstraintType(ConstraintType ct)
{
QString s;
switch (ct) {
case ConstraintType::Check:
s = "C";
break;
case ConstraintType::ForeignKey:
s = "FK";
break;
case ConstraintType::PrimaryKey:
s = "PK";
break;
case ConstraintType::Unique:
s = "U";
break;
case ConstraintType::ConstraintTrigger:
s = "CT";
break;
case ConstraintType::ExclusionConstraint:
s = "XC";
break;
default:
s = "?";
break;
}
return s;
}
QString LongNameForConstraintType(ConstraintType ct)
{
QString s;
switch (ct) {
case ConstraintType::Check:
s = "check";
break;
case ConstraintType::ForeignKey:
s = "foreign key";
break;
case ConstraintType::PrimaryKey:
s = "primary key";
break;
case ConstraintType::Unique:
s = "unique";
break;
case ConstraintType::ConstraintTrigger:
s = "constraint trigger";
break;
case ConstraintType::ExclusionConstraint:
s = "exclusion constraint";
break;
default:
s = "?";
break;
}
return s;
}
void operator<<(ForeignKeyAction &s, const Pgsql::Value &v)
{
const char *c = v.c_str();
@ -64,6 +122,7 @@ void operator<<(ForeignKeyMatch &s, const Pgsql::Value &v)
}
PgConstraint::PgConstraint()
{