| Generate code SQL in Eclipse [message #552635]
||Thu, 12 August 2010 19:28
Registered: August 2010
Find this code and would like to try it but I need to run it I have only the metamodel is a class diagram which incidentally has a table called DB Model, if someone can explain? or give me an email to talk, I need this info is very important to me now. To pass such a model class to generate SQL code I need the SQL metamodel? you use, because I read somewhere that relies on technology to pass. I appreciate your answers.|
texttransformation relationalModel2sql (in relational: "http:///relational.ecore") (
fileExtension property = '. sql'
relational.DBModel:: main () (
stdout.println ('starting transformation')
relational.DBModel:: mapDBModel () (
file (self.name + fileExtension)
'\ NCREATE DATABASE' self.name '; "
self.tables -> forEach (table: relational.Table) (
relational.Table:: mapTable () (
'\ N \ nCREATE TABLE' self.name '('
self.columns -> forEach (col: relational.Column) (
if (! self.columns.last () == col) (
relational.Column:: mapColumn () (
'\ N \ t' self.name '' self.type.mapType ()
if (self.keyOf! = null) (
'PIMARY KEY NOT NULL'
Powered by FUDForum
. Page generated in 0.02919 seconds