Book a Demo

Author Topic: Syntax  (Read 5798 times)

Amy_N

  • EA User
  • **
  • Posts: 28
  • Karma: +1/-0
    • View Profile
Syntax
« on: June 19, 2015, 01:44:44 pm »
I am trying to do a number of things. One of these is using SQL e.g. to create charts but also editing the database directly. Is there a list of the syntax anywhere?

I am also interested in the syntax used in Sparx directly e.g. for shape scripts. Is there a list of commands anywhere?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Syntax
« Reply #1 on: June 19, 2015, 04:15:16 pm »
There is not EA specific syntax.
EA just forwards the SQL to the underlying database, so you'll need to use the SQL dialect of the repositories database type.

For scripting you can use VBScript, JavaScript and JScript using their standard syntax.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Syntax
« Reply #2 on: June 19, 2015, 07:06:24 pm »
"just forwards" is not completely true. EA uses it's own compiler first. Some keywords (e.g. AS) must be capitalized. The column Note(s?) is treated specially.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Syntax
« Reply #3 on: June 22, 2015, 08:43:01 am »
Quote
EA just forwards the SQL to the underlying database, so you'll need to use the SQL dialect of the repositories database type.
Quote
"just forwards" is not completely true. EA uses it's own compiler first. Some keywords (e.g. AS) must be capitalized. The column Note(s?) is treated specially.
Although there are a couple of situations where EA does process the sql, the examples provided by qwerty aren't. They are examples of how EA handles the information coming back from the server.

  • ea_guid AS CLASSGUID must be in sql results exactly for EA to try matching to an element
  • Note column can be hidden, show a short preview below the row or show the full notes below the row
  • Object_Type will show the profile metatype if available.

There are things that EA looks for before sending the request to the server. See Create Search Definitions for the list.

That list is mainly for custom sql searches. It won't be handled in all situations, but if my memory serves they can be used for charts as well.

The other alteration that could come up, is wrapping keywords in square brackets. eg. select [Value] from t_objectproperties
« Last Edit: June 22, 2015, 08:49:48 am by simonm »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Syntax
« Reply #4 on: June 22, 2015, 02:47:47 pm »
Quote
The other alteration that could come up, is wrapping keywords in square brackets. eg. select [Value] from t_objectproperties
So if my memory serves well this is only valid for M$Access/EAP. Other SQL derivates demand back-ticks or other quotes instead of square brackets.
q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Syntax
« Reply #5 on: June 22, 2015, 04:37:37 pm »
Quote
Quote
The other alteration that could come up, is wrapping keywords in square brackets. eg. select [Value] from t_objectproperties
So if my memory serves well this is only valid for M$Access/EAP. Other SQL derivates demand back-ticks or other quotes instead of square brackets.
q.
The square brackets work for SQL Server as well. And if they work for SQL server then they will probably work for ASA as well as SQL Server was orginally the Sybase database engine before Microsoft purchased and rebranded it. I'm not sure about other SQL dialects though.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Syntax
« Reply #6 on: June 22, 2015, 04:44:32 pm »
It looks like the different dialects are more tolerant than I thought. SQLite accepts square brackets as well as back ticks.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Syntax
« Reply #7 on: June 23, 2015, 08:31:11 am »
Quote
The other alteration that could come up, is wrapping keywords in square brackets. eg. select [Value] from t_objectproperties
I mentioned this because EA explicitly handles it for all sql queries it runs. Otherwise it would still fit under the category of "use the SQL dialect of the repositories database type".