Book a Demo

Author Topic: DDL transformation datatypes  (Read 5655 times)

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
DDL transformation datatypes
« on: January 22, 2007, 09:50:29 pm »
I have a PIM which I am transforming into a DDL PSM using the built-in DDL transformation.  The problem I am having is specifying data types in the PIM and what they end up as in the DDL model.  For example, in the PIM I have a column of type "varchar" but this gets converted into a column of type "text" and I then have to manually change these back :(
Other datatypes seem to be ok, eg int, numeric, char etc but varchar gets converted to text!

I have the default database set to "SQL Server 2000" (in Tools/Options/Source Code Engineering/Code Editors/Default Database).  Everything in "Settings/Daatbase Datatypes..." looks okay.  Any ideas on why this is happening or what I am missing?
Cheers, Mark

thomaskilian

  • Guest
Re: DDL transformation datatypes
« Reply #1 on: January 23, 2007, 12:13:55 am »
You're missing nothing. DDL transformation is done via a pre-defined script. If you want it to do other things than it does, then you have to change it. Look at this script as a template which performs a general transformation. You are free to create copies which perform special flavours.

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: DDL transformation datatypes
« Reply #2 on: January 28, 2007, 10:54:41 pm »
Thanks for the reply, Thomas, but perhaps I didn't explain myself clearly.  It is not the generation of the DDL scripts that I am looking at its the built-in MDA transformation called DDL which transforms an abstract class model into a data model - which is then used to generate the DDL scripts.  If I edit the database types and rename "text" to "textXXX" (both common type and datatype) then an attribute type of "string" gets converted to varchar however if I leave the text datatype as default then string and varchar get converted to text.
Cheers, Mark

thomaskilian

  • Guest
Re: DDL transformation datatypes
« Reply #3 on: January 29, 2007, 11:07:48 pm »
I didn't get you wrong. See Settings/Transformation Templates/DDL/Attribute. Here you need to make the appropriate changes.

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: DDL transformation datatypes
« Reply #4 on: January 31, 2007, 04:36:24 pm »
OK, I'm with you.  Thanks.
Cheers, Mark

bscott

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: DDL transformation datatypes
« Reply #5 on: February 13, 2007, 12:04:20 am »
Hi,

I don't understand.

If I set a class attribute type to string and add a string ->varchar mapping to SQL200 database and set this database as the default, the type gets transformed to text.

If I set the class attribute type to mystring and map mystring->varchar then the type gets tranformed to varchar.

The transfromation template for attribute contains:-

 type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,attType)%%qt%

I understand this to mean: lookup the class attribute type as commontype in the datatype/commontype mapping list for the default database and transform commontype to datatype if the mapping exists.

I don't know what I need to change to get string transformed to varchar.

Thanks,

thomaskilian

  • Guest
Re: DDL transformation datatypes
« Reply #6 on: February 13, 2007, 01:07:44 pm »
maybe the good old if-then-else would help here (instead of using the macro).

doctor_uv

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: DDL transformation datatypes
« Reply #7 on: July 17, 2007, 05:29:40 am »
Can I understand from this discussion that I have to be prepared that the code datatypes in the settings might not get observed in some scenarios?

I am trying to get a String converted into a string for C#....
and while this works for Boolean ==> bool my settings for the strings get ignored....

Does this sound familiar to anyone?
Dr. UV
Software Architect
Alcatel-Lucent IPTV

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: DDL transformation datatypes
« Reply #8 on: July 23, 2007, 07:16:56 pm »
Yes, unfortunately, familiar to me. I have not been able to get String to transform to varchar in DDL transformation without, as I said, renaming "text" (or bscott's solution is better, ie use "mystring" but then you need to add mystring to each codetype/database type).
There is obviously something wrong with how String is handled.    
Cheers, Mark

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: DDL transformation datatypes
« Reply #9 on: July 24, 2007, 01:56:06 am »
Has anyone reported this to Sparx? If so, have you heard back from them?

It almost sounds like the templates are not case sensitive... Something like that would be fine for VB and DDL, but hopeless in the C world.

David
No, you can't have it!