SISSy SQL Statements to get SoMoX GAST usage

Aus SDQ-Wiki
Zur Navigation springen Zur Suche springen
 Läuft nicht auf Derby, aber auf Postgres

alle Zugriffe in org.somox.* auf Modelelemente in de.fzi.gast.*

--alle Zugriffe in org.somox.*

create view allaccinsomox as 
 select id, targetid 
 from TACCESSES acc 
 where 
 acc.PACKAGEID in (select id from TPACKAGES where TPACKAGES.FULLNAME like '%org.somox%') 


--alle Zugriffe davon auf Modelelemente in de.fzi.gast*

create view allacctogast as
 select distinct targetid 
 from ALLACCINSOMOX 
 where targetid in (select id from TMODELELEMENTS where PARENTID in(select id IDFORGASTPACKAGE from TPACKAGES where TPACKAGES.FULLNAME like '%de.fzi.gast%'))

--Zugriff-ID verbunden mit Modelelementen

create view usedelems as
 select * 
 from allacctogast left join TModelelements on allacctogast.targetid = tmodelelements.id

--Ergebnis

create view usedclasses as
 select usedelems.id classid,usedelems.name classname ,fullname packagename
 from usedelems left join tpackages on usedelems.parentid = tpackages.id 
 where not upper(substr(usedelems.name,1,1)) <> substr(usedelems.name,1,1)

all methods of the selected classes that are used in org.somox.*

-- von SoMoX benutzte Methoden in den GAST-Klassen, die benutzt werden in SoMoX

create view usedclassmethods as
select * from tfunctions
where packageid in (select id from TPACKAGES where TPACKAGES.FULLNAME like '%de.fzi.gast%') 
 and classid in (select classid from usedclasses)
 and kindoffunction <> 53 --not constructor
 and id in (select targetid from allaccinsomox)
order by name

--Zusätzlich mit Paketname

create view usedmethodswithpackage as
select packages.fullname,methods.name,classid 
from usedclassmethods as methods left join tpackages as packages on methods.packageid = packages.id 
order by packages.fullname,methods.name

--Zusätzlich mit Klassenname

create view usedmethodswithpackage as
select packages.fullname,methods.name,classid, returntypedeclarationid rettypeid
from usedclassmethods as methods left join tpackages as packages on methods.packageid = packages.id 
order by packages.fullname,methods.name

--Zusätzlich mit Klassenname

create view rettypehelper as
select usedmethodswithpackage.fullname packagename,ttypes.name classname ,usedmethodswithpackage.name methodname, rettypeid
from usedmethodswithpackage left join ttypes on usedmethodswithpackage.classid=ttypes.id 
order by usedmethodswithpackage.fullname,ttypes.name,usedmethodswithpackage.name


create view rettypehelper2 as
select packagename, classname, methodname
from rettypehelper left join taccesses on rettypehelper.rettypeid = taccesses.id


select rettypehelper2.*, name returntypename
from rettypehelper2 left join ttypes on targetid = id


TODO: Get parameter-types