[Uml-devel] [Bug 73632] attribute comments with sqlwriter produces invalid SQL

Riku Voipio nchip at kos.to
Sun Feb 1 14:04:04 UTC 2004

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

------- Additional Comments From nchip at kos.to  2004-02-01 21:39 -------
bugzilla decided not want mail from me, so let me past it...

On Sun, Feb 01, 2004 at 06:15:53PM -0000, Sebastian Stein wrote:
> ------- You are receiving this mail because: -------
> > The umbrello generate code -> SQL does not produce anything
> > meaningfull. comments get mixed between declarations
> Maybe this is a feature. Or how do you add things like NOT NULL? If you use
> the comment, you can add it directly behind the column name and type.

Thing like NOT NULL are not really comments they are vital part 
of the data definition. It would be inconsistent to have 
varchar(200) (the field lenght) in the attribute type field, 
and other parts of definition in the comment field. 

Plus, where would put the REAL comments of the field, if the
comment field becomes magically an semantic field. Like in
the example I gave in the bug report, where I documented the
possible integer values of an field. 

> > and most declarations are not separated by "," like they should.
> This seems to be true sometimes, e.g. if you create a empty table, so a
> class without attributes.

This bug is because the original author is passing first by value
to printAttributes and uses it like it would be passed by reference.
You will only notice this if you use attributes of diffrent scope
(public, protected, private)

> >         CONSTRAINT  FOREIGN KEY (1) REFERENCES blacklist(0..*)
> You also have to 

I didn't touch the FOREIGN KEY code - It was broken already. I
don't really know what it is supposed to do, so I only fixed
the attributes part.

> give the association a name, this would be the key. The (1) 
> is wrong, I think it should point to the column in the source table,
> which can be set as a role. 

Using the multi fields in creating foreign key definitions like
the current code does is definetly wrong yes. 

> Also, I don't understand, why the constraint is added to both tables. I
> think it should only be added to 1 table (where the rhombus is connected
> to).

Actually, In my tests, the constraint is only added to the correct table
(the one with the foreign key).

In this case the correnct constraint would be:

FOREIGN KEY (tld) REFERENCES tld (tld_text)

or more compactly in the attribute definition

        tld varchar(40) REFERENCES tld,

since tld_text is the primary key of tld, we dont need to type it

All of this offcourse using postgresSQL syntax.

> Maybe you can start with making a class diagram and write down what sql code
> you expect. 

The problem is, that UML doesn't really support SQL-like relationships,
it is ment more to c++/java style relationships. I need find an 
UML+SQL book if I want to fix it more seriously.

> I think the roles are misinterpreted at
> the moment as well, because instead of the names the count or something like
> this is added to the sql output.

It uses the name of association as the constraint name and Multplicity
as the field being referenced... Using rolename instead of multicipity
would be a improvement thou, altough I dont think the UML assosciation
rolename is meant for that.

More information about the umbrello-devel mailing list