Author Topic: Build SQL Query  (Read 3219 times)

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Build SQL Query
« 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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Build SQL Query
« Reply #1 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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Build SQL Query
« Reply #2 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.
« Last Edit: July 24, 2012, 09:43:06 pm by qwerty »

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: Build SQL Query
« Reply #3 on: July 24, 2012, 11:28:09 pm »
Please, more tips how to do it. I'm absolutely new in this area.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Build SQL Query
« Reply #4 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".

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: Build SQL Query
« Reply #5 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