[Uml-devel] KDE_3_2_BRANCH: kdesdk/umbrello/umbrello/codegenerators

Jonathan Riddell jri at jriddell.org
Mon Mar 15 14:28:38 UTC 2004


CVS commit by jriddell: 

Backport recent commit
--

CVS commit by jriddell:

Fix for beastie 77377: SQL code generator generates "circular reference" foreign keys
>From "Maciej J.Woloszyk" <mat_AT_esi.com.pl>


  M +7 -2      sqlwriter.cpp   1.8.2.1


--- kdesdk/umbrello/umbrello/codegenerators/sqlwriter.cpp  #1.8:1.8.2.1
@@ -90,8 +90,13 @@ void SQLWriter::writeClass(UMLClassifier
         if( forceSections() || !aggregations.isEmpty() ) {
                 for(UMLAssociation* a = aggregations.first(); a; a = aggregations.next()) {
+                        if( a->getObjectA()->getID()==c->getID() ) {
+                                sql << "\n-- CONSTRAINT " << a->getName() << " FOREIGN KEY (" << a->getMultiB() <<
+                                        ") REFERENCES " <<   a->getObjectA()->getName() << "(" << a->getMultiA() << ")";
+                        } else {
                         sql << ",\n\tCONSTRAINT " << a->getName() << " FOREIGN KEY (" << a->getMultiB() <<
                                ") REFERENCES " <<   a->getObjectA()->getName() << "(" << a->getMultiA() << ")";
                 }
         }
+        }
 
         sql<<"\n);\n";






More information about the umbrello-devel mailing list