Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: zalbina on July 24, 2012, 06:22:46 pm

Title: Build SQL Query
Post by: zalbina on July 24, 2012, 06:22:46 pm
Hello,

Is it possible to build a SQL Query in order to change class attributes or stereotype of a class, save the query and use it after?

Thanks.
Title: Re: Build SQL Query
Post by: Geert Bellekens on July 24, 2012, 06:50:35 pm
Yes it is.

The easiest is to execute it using some kind of generic SQL client.
You could also write a script that executes the sql statement using the undocumented operation EA.Repository.Execute

Geert
Title: Re: Build SQL Query
Post by: qwerty on July 24, 2012, 09:41:39 pm
No, it isn't (if you mean EA's query builder). The query builder allows only for writing SELECT statements. If you want to use UPDATE you need to script that with the method mentioned by Geert.

You can read more about this subject in my book Inside EA.

q.
Title: Re: Build SQL Query
Post by: zalbina on July 24, 2012, 11:28:09 pm
Please, more tips how to do it. I'm absolutely new in this area.
Title: Re: Build SQL Query
Post by: Eve on July 25, 2012, 02:07:57 pm
My tip is don't.

The function mentioned is undocumented because there is absolutely no support for using it. These guys are using it because they have both invested considerable time learning the ins and outs of EA and are willing to take the risks associated with using something unsupported that could potentially irreparably damage their model. In comparison you rate yourself as "absolutely new in this area".
Title: Re: Build SQL Query
Post by: Dermot on July 25, 2012, 04:15:30 pm
As Simon states the DBMS alteration is not documented for good reason. However you can make alterations usng Automation Script. This is the recommended and documented option. See: http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/automation/automation_interface.html