10
« on: March 01, 2006, 08:13:50 am »
Thanks Thomas,
Actually I had spent a fair bit of time playing with this stuff yesterday and here is what I found.
1) I actually tried modifying the DDL_DataTypes.xml file. None of the changes I made appeared to have any effect on the generated tables or in the way the DDL transform generated stuff.
2) I was actually able to get somewhat proper DDL (for things one would expect the system to understand, not nested classes, etc) to be generated.
Caveat: I still can't seem to get it to include attributes from parent classes in the table schema. Anyone have any luck with this.
You will always have to go back and manually create the Primary Keys and modify columns which associate with other complex class types.
To get it to work I did the following:
1) I created a new language in the Code Datatypes and called it in my case MDCDatabase
1.1) I specified the database types I would be using for my columns and mapped them to the generic type names used in the code types not the database types. for example String, Double, Ulong, etc. instead of varchar,float, bigint.
2) I made a new transformation type which I again called MDC_DDL. I patterned it on the current DDL tranform with some changes to gegt the type conversion better.
I have included it here incase anyone else finds this useful.
FILE:
Package
{
name="MDC_DDL"
namespaceroot="true"
%list="Namespace" @separator="\n\n" @indent=" "%
}
NAMESPACE:
%list="Namespace" @separator="\n\n"%
%list="Class" @separator="\n\n"%
CLASS:
Table
{
%TRANSFORM_REFERENCE("Table")%
%TRANSFORM_CURRENT("language")%
language=%qt%%MDCDatabase%%qt%
%list="Attribute" @separator="\n" @indent=" "%
PrimaryKey
{
Column
{
name=%qt%%CONVERT_NAME(className, "Pascal Case","Pascal Case")%ID%qt%
type=%qt%%CONVERT_TYPE("MDCDatabase","ULong")%%qt%
}
}
}
%list="Connector" @separator="\n"%
ATTRIBUTE:
Column
{
name=%qt%%attName%%qt%
type=%qt%%CONVERT_TYPE("MDCDatabase",attType)%%qt%
}
I removed any Foreign Key stuff as I personally don't like using them.
Anyhow this works better. Note the language setting are set to point to the new language I defined, which maps the UML Code Types to the database types I want them to be.
This way I can get some of the database stuff to come out right.
Now if I could just figure out how to get the attributes of the parent class included in the child classes corresponding table, I think this would be about the best I can do with this.
Hope this is of help to others.
Paul