Permalink
Browse files

Introduced a new type of relationship. FK Relationships, created

automatically when user add foreign keys by hand on tables.

Fixed version spelling: alfa1 -> alpha1.
  • Loading branch information...
1 parent 1c8bcf2 commit b682a0e0696217c42fa32b7c4c20ec34261a8f54 @rkhaotix rkhaotix committed Dec 15, 2012
@@ -520,7 +520,7 @@ void OGRelacionamento::configurarLinha(void)
}
}
- //Caso o relacionamento seja de dependência a linha será tracejada
+ //Caso o relacionamento seja de dependência e seja entre uma tabela-visão a linha será tracejada
pen=ObjetoGrafico::obterEstiloBorda(ParsersAttributes::RELATIONSHIP);
if(rel_base->getRelationshipType()==BaseRelationship::RELATIONSHIP_DEP)
pen.setStyle(Qt::DashLine);
@@ -628,6 +628,7 @@ void OGRelacionamento::configurarDescritor(void)
//Configura o estilo da borda do descritor
pen=ObjetoGrafico::obterEstiloBorda(ParsersAttributes::RELATIONSHIP);
+
if(tipo_rel==BaseRelationship::RELATIONSHIP_DEP)
pen.setStyle(Qt::DashLine);
@@ -23,9 +23,9 @@ QString BaseObject::obj_type_names[OBJECT_TYPE_COUNT]={
QT_TR_NOOP("Sequence"), QT_TR_NOOP("Role"), QT_TR_NOOP("Conversion"),
QT_TR_NOOP("Cast"), QT_TR_NOOP("Language"), QT_TR_NOOP("Type"), QT_TR_NOOP("Tablespace"),
QT_TR_NOOP("Operator Family"), QT_TR_NOOP("Operator Class"),
- QT_TR_NOOP("Database"), QT_TR_NOOP("Table-Table Relationship"),
+ QT_TR_NOOP("Database"), QT_TR_NOOP("Table Relationship"),
QT_TR_NOOP("Textbox"), QT_TR_NOOP("Permission"), QT_TR_NOOP("Parameter"),
- QT_TR_NOOP("Table-View Relationship")
+ QT_TR_NOOP("Basic Relationship")
};
QString BaseObject::objs_sql[OBJECT_TYPE_COUNT]={
@@ -69,7 +69,7 @@ void BaseRelationship::configureRelationship(void)
//Check if the relationship type is valid
- if(rel_type <= RELATIONSHIP_DEP)
+ if(rel_type <= RELATIONSHIP_FK)
{
try
{
@@ -179,10 +179,14 @@ void BaseRelationship::setMandatoryTable(unsigned table_id, bool value)
{
if(rel_type==RELATIONSHIP_11)
lables[label_id]->setComment("(" + cmin + ",1)");
- else if(rel_type==RELATIONSHIP_1N)
+ else if(rel_type==RELATIONSHIP_1N || rel_type==RELATIONSHIP_FK)
{
aux=(table_id==SRC_TABLE ? "1" : "n");
- lables[label_id]->setComment("(" + cmin + "," + aux + ")");
+
+ if(rel_type==RELATIONSHIP_1N)
+ lables[label_id]->setComment("(" + cmin + "," + aux + ")");
+ else
+ lables[label_id]->setComment("(" + aux + ")");
}
else if(rel_type==RELATIONSHIP_NN)
lables[label_id]->setComment("(n)");
@@ -216,6 +220,7 @@ void BaseRelationship::disconnectRelationship(void)
connected=false;
src_table->setModified(true);
dst_table->setModified(true);
+ this->setModified(true);
}
}
@@ -226,6 +231,7 @@ void BaseRelationship::connectRelationship(void)
connected=true;
src_table->setModified(true);
dst_table->setModified(true);
+ this->setModified(true);
}
}
@@ -267,6 +273,7 @@ void BaseRelationship::setRelationshipAttributes(void)
case RELATIONSHIP_1N: attributes[ParsersAttributes::TYPE]=ParsersAttributes::RELATIONSHIP_1N; break;
case RELATIONSHIP_NN: attributes[ParsersAttributes::TYPE]=ParsersAttributes::RELATIONSHIP_NN; break;
case RELATIONSHIP_GEN: attributes[ParsersAttributes::TYPE]=ParsersAttributes::RELATIONSHIP_GEN; break;
+ case RELATIONSHIP_FK: attributes[ParsersAttributes::TYPE]=ParsersAttributes::RELATIONSHIP_FK; break;
default:
if(src_table->getObjectType()==OBJ_VIEW)
attributes[ParsersAttributes::TYPE]=ParsersAttributes::RELATION_TAB_VIEW;
@@ -78,7 +78,8 @@ class BaseRelationship: public BaseGraphicObject {
RELATIONSHIP_1N=20, //One to many
RELATIONSHIP_NN=30, //Many to many
RELATIONSHIP_GEN=40, //Generalization (Inheritance)
- RELATIONSHIP_DEP=50; //Dependency (table-view) / Copy (table-table)
+ RELATIONSHIP_DEP=50, //Dependency (table-view) / Copy (table-table)
+ RELATIONSHIP_FK=60; //Relationship generated by creating a foreign key manually on a table
//Constats used to reference the relationship labels
static const unsigned LABEL_SRC_CARD=0,
Oops, something went wrong.

0 comments on commit b682a0e

Please sign in to comment.